function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Varun Sinha 17Varun Sinha 17 

Need To Capture Data from URL

I am getting some response back from the web service in a url i.e
https://cummins--cssdev.cs50.my.salesforce.com/a093B0000006oTdQAI?DSStatus=OPEN&DSID=DSBDT3497

Now from this url I need to save DSSTATUS and DSID in a custom object.
Can anyone help me with this.
Thank You in advance.
Ashish DevAshish Dev
If you are sure you will get DSStatus first and DSID in the last. You can use string class methods like below.
string str = 'https://cummins--cssdev.cs50.my.salesforce.com/a093B0000006oTdQAI?DSStatus=OPEN&DSID=DSBDT3497';
system.debug(str.substringBetween('DSStatus=', '&'));
    system.debug(str.substringAfter('DSID='));

 
Varun Sinha 17Varun Sinha 17
Need to ask you one more thing After I am redirecting to the url and coming back to the page my url is changing.How to save this url now after redirecting I am confused.Can you please help me with that?
Ashish DevAshish Dev
You can send return url as a query parameter like retUrl={!$CurrentPage.Url}