How to read sys_id from result of HTTP request - which body POST is in XML fromat

I created a POST Http request in XML format… which is working fine means IT create incident.
image
I can see the whole created case data through varibale “strAPIresult” in Message box.

But I need to extract or take out the “sys_id” of that created incident and i do not know how to get that.
I tried with strAPIresult(“sys_id”).ToString but its giving Error…

can someone help… thanks in advance…

@Palaniyappan @supermanPunch

1 Like

Hi,

Is the response XML format? If so, perhaps you should deserialize it using Deserialize XML activity.
Can you share your response string (as a file)?

Regards,

yes its giving all in XML file like <></> means data in the xml tags…
I tried with Deserialized XML also but its not giving me data sys_Id
image
kindly help who to extract form xml result…

@Latif Can you just check the value of XMLResult in message box ?

yes i can and it show all data in xml file…

like this
image

Hi,

I suppose you might need to consider about XML Namespace.
Can you share your whole xml string as a file?

Regards,

I do not understand how to manipulate the data means how can take perticular data out from this xml result. sys_id or SNnumber or whatever info it have so I can be sure that my ticket is created

@Latif Can you tell me what is the Starting Value in that Xml value ?

Also the workflow below has an example of how to get the value you need from the xml. Check it and apply it for your case and let us know what you get.
Deserialize XML Values.zip (1.5 KB)

Check the Text file first, Check the Workflow and the method I have used to get that particular value from the Xml file. Execute the Workflow. You might be able to apply it to your case as well.

I understand ur flow but its not working in my case…
XMLResult.Element(“result”).Element(“sys_id”)

Getting this error…
Assign: Object reference not set to an instance of an object.

@Latif So Is “<result>” your outermost node ?

Maybe it will be easier to identify and solve the problem, if you could just provide the data what you get in a text file :sweat_smile:

xmlresult.txt (8.1 KB)

@Latif I guess there’s an error in the xml data that you have sent, there’s a <short_description> tag which doesn’t have a corresponding end tag i.e </short_description>
xml

If that’s the actual response that you get, then I guess we can just use regex to get the value you need. Check the workflow below, that gets the value using regex :
Regex Find.zip (3.9 KB)

2 Likes

The xml reault is different as its from SN… and every xml syntex is ending like this…
</u_question> and it worked fine as its create record in the system.
Thanks your regex is working perfect as i needed…
thanks alot @supermanPunch

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.