+ Start a Discussion
Rohit RadhakrishnanRohit Radhakrishnan 

Issue with Create record using SFDX

Hi All,
Can someone help me with the below issue on sfdx?
I'm running the below command:
sfdx force:data:record:create -t -s TraceFlag -v "DebugLevelId=7dl3Y000000XirWQAS StartDate=2020-06-05 ExpirationDate=2020-06-06 LogType=USER_DEBUG TracedEntityId=0054H000005sUT7" -u salesforce.admin@rorcom.com.customer
I get an error : ERROR running force:data:record:create: insufficient access rights on cross-reference id: 7dl3Y000000XirW
I am trying to insert a traceflag record for a user record and referring the Debug Level as "SFDC_DevConsole "which has the id "7dl3Y000000XirWQAS"
The user salesforce.admin@rorcom.com.customer is having a system administrator profile and system admin is added as a profile in a connected app that has "Admin approved user may self Authorize" option set. I have logged into the org using a JWT token running the "sfdx force:auth:jwt:grant" command and login was successful with the message: "Successfully authorized salesforce.admin@rorcom.com.customer with org ID 00Dxxxxxxxxxxxx".
SwethaSwetha (Salesforce Developers) 
HI Rohit,

I tried using the same command and could succeed. See the screenshot
User-added image

Can you retry setting the appropriate start and end dates and see if it fixes the issue?
Rohit RadhakrishnanRohit Radhakrishnan
Thanks, Swetha. I just retried with proper dates and still the same issue. Am using a JWT based auth and running the commands from Azure Pipeline. Will that matter?
SwethaSwetha (Salesforce Developers) 
HI Rohit, Are you facing issue only with setting debug trace flag or with any other operation too? 
Rohit RadhakrishnanRohit Radhakrishnan
I get this error when I use the Debug Level as SFDC_DevConsole. If I use a custom level, then I could insert the record. Sent from Outlook Mobile
SwethaSwetha (Salesforce Developers) 
Strange! It does not seem to be an issue with JWT based auth or because you are running the commands from Azure Pipeline as you can set the debug level for other custom levels. Is this reproducible across all the orgs when the Debug Level is set as SFDC_DevConsole?