- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2023 03:32 AM
Hi All,
I have script include Output as below:
- return ID+ GroupName;
i.e. 12345abcd6789Hardware
Now, I need to use both the outputs i.e., ID and group name in client script.
Here, group name can be anything, so how can I show that in client script?
Requirement: How can I split the output from script include? as I want to use ID in if statement and group name in error message.
Client script:
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2023 04:39 AM
Hi could you please try below;
return (ID+ ":" +GroupName).toString();
function scriptinclude (response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
answer = answer.split(":");
g_form.addInfoMessage(answer[0]);
g_form.addInfoMessage(answer[1]);
if (answer[1] == 'abcd6789' ) {
g_form.addErrorMessage('GroupName already exist with this id'); //Groupname will be groupname obtained from output of script include
} else if (answer[1] == 'tyu1415'){
g_form.addErrorMessage('GroupName already exist with this id'); //Groupname will be groupname obtained from output of script include
}
}
If my answer solved your issue, please mark my answer as ✅Correct & 👍Helpful based on the Impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2023 04:50 AM
Hi @Karan Chhabra6 ,
Thank you for your help..!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2023 05:02 AM
@Rakshanda Kunte - if the solution worked for you, please mark it as correct and helpful
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2023 05:10 AM
Solution provided by @Karan Chhabra6 is also correct 🙂 , you missed to parse the data though he has mentioned in his script
var a = JSON.parse(response.responseXML.documentElement.getAttribute("answer"));
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2023 04:39 AM
Hi could you please try below;
return (ID+ ":" +GroupName).toString();
function scriptinclude (response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
answer = answer.split(":");
g_form.addInfoMessage(answer[0]);
g_form.addInfoMessage(answer[1]);
if (answer[1] == 'abcd6789' ) {
g_form.addErrorMessage('GroupName already exist with this id'); //Groupname will be groupname obtained from output of script include
} else if (answer[1] == 'tyu1415'){
g_form.addErrorMessage('GroupName already exist with this id'); //Groupname will be groupname obtained from output of script include
}
}
If my answer solved your issue, please mark my answer as ✅Correct & 👍Helpful based on the Impact.