Hello, i am performing an salesforce to salesforce integration between two orgs, namely target and source orgs.
But when i create a rest endpoint class in target and a request class in source org, then once i run it i am receiving this error:
"Apex script unhandled exception by user/organization: 005gK0000068gUr/00DgK000008kSkh
Organization: A2Z (
orgfarm-***-dev-ed.develop.my.salesforce.com
).
Failed to invoke future method 'public static void getdetails()' on class 'salesforcesourceorg' for job id '707gK00000G7TZh'
caused by: System.CalloutException: We couldn't access the credential(s). You might not have the required permissions, or the external credential "TargetOrg_EC" might not exist.
Class.salesforcesourceorg.getdetails: line 10, column 1"
Note:
I have performed following steps:
Created a external client app in target org.
Created auth. provider in source org with consumer key and secret key.
Updated the callback url in target org.
Created external credential in source org >> Authorised using target org username and password.
Created named credential selecting newly created external credential.
Created new dummy account in target org.
Created new apex class in target org for Get request.
Created new apex class in source org for fetching the accounts in target org.
And then got the previously mentioned error.
Unsuccessfull Steps which i already performed to cater this issue:
Checked the callback url.
Confimed that i have system admin access in both org.
I have also shared the screenshots.
If anyone knows how to solve this issue, please do let me know.
Thanks in advance.