• LinThaw
  • SMARTIE
  • 1724 Points
  • Member since 2016
  • Salesforce Developer, Lightning Champion
  • Canon IT Solutions Inc.


  • Chatter
    Feed
  • 2
    Best Answers
  • 11
    Likes Received
  • 3
    Likes Given
  • 91
    Questions
  • 221
    Replies
Hi there,
How can I get users who can access the current record from apex,
look like this standard Sharing Hierarchy Page as below.
User-added imageIs there easy way to get them rather than using shared object, group, groupmember and userrole.
Thanks for any suggestion.
Regards,
LinThaw
We have successfully implemented SSO with Azure AD (SAML based).

We are also building an API that will have a connection to Azure AD to authenticate requests.  The API we are building can accept OpenID or SAML based auth.

The issue we're facing is trying to figure out how to send the authorization along with the API request.

One approach I'm investigating is using a Named Credential with a custom authentication provider (Open ID provider to Azure AD).  But I'm not sure if this is necessary since we already have SSO implemented.

The Apex code would look like this with this approach:
Http http = new Http();
HttpRequest request = new HttpRequest();
request.setEndpoint('callout:MY_API_URL/');
request.setMethod('POST');
request.setHeader('Content-Type''application/json;charset=UTF-8');
request.setBody(JSON.serialize(orderPayload));
HttpResponse response = http.send(request);
return response;

If this seems like a reasonable approach, please confirm.  If there's a better way to do this, please let me know. 

It seems that since we already have SSO with Azure set up, we could leverage that without configuring anything more.  But I cannot find any documentation on how to set this up (and what I would need to do in Apex code when calling the API).
Hi there,

Is there any documentation from salesforce to find List of Objects that can be managed or supported by Approval Process? such as Account, Case, Contact, Custom Object etc,.

We have to confirm Event and Task can't be managed by Approval Process (https://trailblazer.salesforce.com/ideaView?id=08730000000BrQCAA0).

Regards,
LinThaw
Hi there,
According to our trailhead module, we can get picklist value by Object Name and Field Name.
Trailhead Module (https://trailhead.salesforce.com/en/content/learn/projects/workshop-override-standard-action/override_2)
@AuraEnabled        
public static List<String> getPickListValuesIntoList(String objectType, String selectedField){
    List<String> pickListValuesList = new List<String>();
    Schema.SObjectType convertToObj = Schema.getGlobalDescribe().get(objectType);
    Schema.DescribeSObjectResult res = convertToObj.getDescribe();
    Schema.DescribeFieldResult fieldResult = res.fields.getMap().get(selectedField).getDescribe();
    List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
    for( Schema.PicklistEntry pickListVal : ple){
        pickListValuesList.add(pickListVal.getLabel());
    }     
    return pickListValuesList;
}

I want to add RecordTypeId to that method.
Any good idea for that?
Thank in advance.
Regards,
LinThaw

I try to pass parameter when opening custom Tab.
but when passing parameter (c__recordId) in state, name of custom Tab is going show Blank. Why is happen? Is there good way to pass parameter when opening custom Tab.

            var navigation = component.find("navigation");
            var pageReference = {
                type: 'standard__navItemPage',
                attributes: {
                    apiName: 'customTab'
                },
                state: {
                    c__recordId: recordId
                }
            }
            component.set("v.pageReference", pageReference);
            navigation.navigate(pageReference);

Thanks in advance,
Regards,
LinThaw
Hi there,

When deploying a flow contain custom notification with ANT Migration tool, I got following error.

Error: CustomNotif (Action) - The action type "Send Custom Notification" can't be used in flows with the process type "Screen Flow".

Any suggest? Thank in advance.
Regards,
LinThaw
Hi there,

How to show Text value of Get Record result in Input Text?
Default Value is not show current value after retry new Get Record.
Thanks in advanced.

Regards,
LinThaw
Hi there,

I am trying following test class with api version 46.
my expected result is as follow.
totalUser = 0 and totalAccount = 0
But totalUser is not 0.
Any suggestion for using with @isTest(SeeAllData = false) User Object?
@isTest(SeeAllData = false)
public class TestClassSample {
    
    private static testMethod void test01() {      
        
        Test.startTest();
        
        System.debug('Total User Record = ' + [Select Count(Id) totalUser From User]);
        
        Test.stopTest();  
    }    
    
    private static testMethod void test02() {      
        
        Test.startTest();
        
        System.debug('Total Account Record = ' + [Select Count(Id) totalAccount From Account]);
        
        Test.stopTest();  
    }
}


Thanks
Regards,
LinThaw
Hi,
I am running following soql in developer console.

Select Count(Id) From User Where UserType = 'CSPLitePortal' and isActive = false

I got following error. 
No such column 'UserType' on entity 'User'

and also got same error when trying with other standard fields or custom fields.

this soql is working well in sandbox but error in production org.
running user's profile is standard administrator.

any suggestion or idea?

Thanks & Regards
LinThaw
I'm building an integration with a SOAP API v1.2, so I'm not able to use WSDL2Apex and I must create my own Request, and send it using Http.send(), storing the endpoint, user and password in a Named Credential.

​This SOAP API uses the standard PasswordDigest security in the XML header, and as this kind of authentication is not managed automaticaly by Salesforce (I do not understand why, it is an standard used frecuently), I must build the XML security header manually by encrypting the nonce + timestamp + password.

As salesforce merge the fields after the Http.send(), I need to obtain the password previously to encrypt it and build the XML header, so I'm not able to use '{!$Credential.Password}' and SOQL do not allows access to ii either.

So, how can I access the Named Credential password to build the XML security header node?
USER_DEBUG [54]|DEBUG|[{"message":"Session expired or invalid","errorCode":"INVALID_SESSION_ID"}] using Named Credential: 


    Request code -
    
                HttpRequest feedRequest = new HttpRequest();
                feedRequest.setEndpoint('callout:full_dev_connection/services/apexrest/v1/getContacts');
                feedRequest.setMethod('GET');
                Http http = new Http();
                HTTPResponse res1= http.send(feedRequest);
                System.debug(res1.getBody());
                
                
>>>Destination org code for calling
    -
  @RestResource(urlMapping='/v1/getContacts/*')
   global with sharing class getContact {
     @Httpget
      global static list<contact> fetchAccount(){
        RestRequest req = RestContext.request;
        RestResponse res = Restcontext.response;
        Id accId = req.requestURI.substring(req.requestURI.lastIndexOf('/')+1);
    
        list<contact> lstcontact =[Select id , name,Phone,Fax,Email from contact where Accountid='001O000000Yk7tl'];
        
        return lstcontact ;
      }
   }    
Hi,

I want to get community URL from apex class.
Is there anyway to get it?

I have been try the following, but I can't get absolute URL.

test -1- the following source only work when debug in developer console.
Network myNetwork = [SELECT Id FROM Network WHERE Name ='myCommunityName' ];
ConnectApi.Community  myCommunity = ConnectApi.Communities.getCommunity(myNetwork.id);
System.debug('MyDebug : ' + myCommunity.siteUrl);

test -2- the following result have extra word /login.
Network myNetwork = [SELECT Id FROM Network WHERE Name ='myCommunityName' ];
System.debug('MyDebug: ' + Network.getLoginUrl(myNetwork.id);

I need to add a small change to the code in production, I know it is not possible via UI, but I read in the documentation that it can be done via either deploy or forceIDE. My thing against deploying is we have lot of tests, and these minor changes come in frequently. So deploying for every minor change takes a lot of time.

 

When doing via forceIDE, can I just modify the code in the IDE's editor and right click the class-> "save to server" ? or do I have "deploy to server" even with forceIDE?

 

Any help with be appreciated.

 

Thanks,

SunnySlp