Read data in url

Hi,

 

Is there a way to read data in an edit page url ?

Like 0

Like

5 comments

Hello Thibault,

 

Would you please provide more details on your question, so that we can check it for you?

Hello Yuliya,

 

I am calling a third party service in order to obtain an authorization code from scratch. After that, I am redirected back to my edit page with a code. The url looks like this: https://079046-studio.creatio.com/0/Shell/?code=Uq-EurbsQyJ1si-mXiw_DW7…. I would like to know how I can retrieve the code to put it in a business process.

Hello,

 

Please review this video material, as it may assist you in implementing your task:

https://www.youtube.com/live/mHaGY1DxETw?feature=share&t=292

https://www.youtube.com/live/ehjfcBxpLsQ?feature=share&t=247

Hi, I think you can try this

 

1. Make parameter to record your code, in my example it is simple string parameter called UsrTest2

2. add script task:

 

string resultString = "https://079046-studio.creatio.com/0/Shell/?code=Uq-EurbsQyJ1si-mXiw_DW7…";

string part = resultString.Substring(0, resultString.LastIndexOf('#'));

string newURL = part;

string[] parts = newURL.Split('=');

string itIsCode = parts[parts.Length-1];

Set<string>("UsrTest2", itIsCode);

return true;



 

3. Get some autogenerated page to see the result

4. Result

now my parameter UsrTest2 holds the code from URL. I can use it anywhere in the process now.

 

Note: this example works if your url is going to be static and there will be no extra symbols. If your url format is changed - this code might not work properly. In that case you will have to query the string to find the code after the word "code=", something like this

 

foreach (string queryString in queryStrings)
{
 if (queryString.StartsWith("code="))
	{	
    string codeValue = queryString.Substring("==".Length);
     Console.WriteLine(codeValue);
   }
}

 

Hi, 

 

Thank you for your answer. The URL will not be static since the code will change with every call. However, I am unsure of how to retrieve the URL string.

Show all comments