You need to sign in to do that
Don't have an account?
Baylor Peak
Help with custom setting to store URL please?
Hello all,
I am storing my enpoint for a REST callout inside a custom setting called MyCustomSettings with Name of 'default'. One of the fields inside the custom setting is a type URL field called 'endpoint' with 'test.com' for the value.
In my code, I have:
MyCustomSettings__c myCS1=MyCustomSettings__c.getValues('default'); string endpoint=myCS1.endpoint__c; request.setHeader('Authorization',authorizationHeader); request.setHeader('Content-Type','application/json'); request.setEndpoint(endpoint);
When I test my code I am getting this error:
System.NullPointerException: Argument 1 cannot be null
What am I missing please?:)
Have you tried checking if it working fine if you directly give the url?
Also, can you once have a look at the below code which I think might be a similar implementation: [https://salesforce.stackexchange.com/questions/45149/how-to-access-custom-setting-url-field-in-apex]
In case if this came in handy can you close the thread and please mark this as the best answer so that it can be used by others in the future and also helps in keeping our community clean.
Regards,
Anutej
I followed https://trailhead.salesforce.com/en/content/learn/modules/apex_integration_services/apex_integration_rest_callouts article to get to know about setting the endpoint in the code.