2

This is part of the Winter '21 release and I was wondering what are the use cases for this?

Can I use it with the current debug logs to get a better picture of a transaction?

1

Let us consider below example whenever we create a contact we need to identify synchronous/asynchronous unknown processes.

trigger testing on Contact (after insert) {
Map<Id,Quiddity> mapIdToQuiddity=new Map<Id,Quiddity>();
set<Id> setActId= new Set<Id>();
List<Account>lstAct=new List<Account>();
Request reqInfo = Request.getCurrent();  //Get info about the current request
system.debug('Req →'+reqInfo );
String currentRequestId = reqInfo.getRequestId();  //Universally unique identifier for this request
//Same as requestId in splunk or REQUEST_ID in event monitoring
system.debug('currentRequestId →'+currentRequestId );
Quiddity currentType = reqInfo.getQuiddity();  //enum representing how Apex is running.
system.debug('Quiddity →'+currentType );
for(Contact oCon:trigger.new)
{
mapIdToQuiddity.put(oCon.accountid,reqInfo.getQuiddity());
setActId.add(oCon.accountid);
}
system.debug('setActId:'+setActId);
for(Account oEachAcc: [select id,Quidity__c from Account where id in :setActId])
{
system.debug('mapIdToQuiddity.get(oEachAcc.id):'+mapIdToQuiddity.get(oEachAcc.id));
oEachAcc.Quidity__c =string.valueof(mapIdToQuiddity.get(oEachAcc.id));
lstAct.add(oEachAcc);
}
Integer count=lstAct?.size();
if(count >0)
{
update lstAct;
}
}

You can use debug logs.

enter image description here

Thanks,

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.