How to pass parameters to powershell function from ecc queue payload
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2024 11:17 PM
Hi All,
I can find below examples of sending parameters from payload to PowerShell scripts as individual arguments. But I am not able to find sending parameters to function inside the PowerShell script like "function (param1, param2)"
Please help me syntax.
example:
ecc.payload = '<?xml version="1.0" encoding="UTF-8"?><parameters><parameter name="name" value="'+value+'"/><parameter name="skip_sensor" value="true"/></parameters>';
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2024 04:41 AM
Hi @san1989 ,
Refer the below article, which may helps you.
Please appreciate the efforts of community contributors by marking appropriate response as Mark my Answer Helpful or Accept Solution this may help other community users to follow correct solution in future.
Thank You
AJ - TechTrek with AJ
Linkedin:- https://www.linkedin.com/in/ajay-kumar-66a91385/
YouTube:- https://www.youtube.com/@learnitomwithaj
ServiceNow Community Rising Star 2024
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2024 11:21 AM
HI this is related to execute the file, I just need to send the parameters to the function in the PowerShell script.
Can you please share any idea on that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2024 12:38 PM
Hi @san1989.
Have a read of the following articles:
- https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0858504
- https://www.servicenow.com/community/developer-articles/execute-powershell-script-from-servicenow/ta...
Basically you can pass the parameters within the ECC's payload and parse them within your PS script.
Cheers