You need to sign in to do that
Don't have an account?
salesforce sfdx
Above code is working fine : need to add the parameters
https://testingorg--dev.sandbox.my.salesforce.com/services/apexrest/DeviceObjserviceendpoint/1234/DateofJoiningValue/TaxNoValue
Soql should have to add where condition of DateofJoining__c ,tax_no__c of customfields.
How to add extra parameters other than the AccountId:
String accountId = request.requestURI.substringAfter( '/DeviceObjserviceendpoint/' ); //got 1234
List<Account> accs = [Select Id, Status__c from Account where Id = :accountId && DateofJoining__c =: DateofJoining && tax_no__c =: TaxNo LIMIT 1];
Best Regards
Sfdx
How to add the parameters working code in the url for the Rest api callouts
@RestResource (urlMapping='/DeviceObjserviceendpoint/*') global class HC_DeviceObj_Rest_Service { @HttpGet global static void doGet() { String result = ''; RestRequest request = RestContext.request; String accountId = request.requestURI.substringAfter( '/DeviceObjserviceendpoint/' ); List<Account> accs = [Select Id, Status__c from Account where Id = :accountId LIMIT 1]; if( accs.size() > 0 ) { Account acc = accs[0]; Map<String,String> resultMap = new Map<String,String> { 'Message' => 'Account found Sucessfully', 'accountId' => acc.Id, 'accountStatus' => acc.Status__c }; result = JSON.serialize( resultMap ); } else { result = 'Account with ID ' + accountId + ' not found!'; } RestContext.response.addHeader('Content-Type','application/json'); RestContext.response.responseBody = Blob.valueOf(result); }
Above code is working fine : need to add the parameters
https://testingorg--dev.sandbox.my.salesforce.com/services/apexrest/DeviceObjserviceendpoint/1234/DateofJoiningValue/TaxNoValue
Soql should have to add where condition of DateofJoining__c ,tax_no__c of customfields.
How to add extra parameters other than the AccountId:
String accountId = request.requestURI.substringAfter( '/DeviceObjserviceendpoint/' ); //got 1234
//string DateofJoining= ??? //How to get the dateofJoiningvalue?? //string TaxNo= ??? //How to get the TaxNo???
List<Account> accs = [Select Id, Status__c from Account where Id = :accountId && DateofJoining__c =: DateofJoining && tax_no__c =: TaxNo LIMIT 1];
Best Regards
Sfdx