UI action client side code is not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2024 01:56 AM
Hi All,
The query is when click on UI action button on the form, product group id needs get from spm_taxonomy_node table then send the product group id to another script include.
Please let me know why it is not working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2024 02:41 AM
Hello Madhusarar,
Looks like your client script is wrong.
I have give sample client script modify function name and parameters accordingly
Please mark my answer helpful If I have helped you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2024 09:19 PM
Hi Jagadish,
Thanks for reply.
In my code I don't want to set the form value, I want to pass response to another script include variable.
Thanks & Regards,
Madhu.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2024 10:45 PM
Assuming you have another function inside the same script include to get the product group, you can make use of below catalog client script to call that function, pass the productGroupID variable to the function as a param and get the productgroup as a response. Please give this a try.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var productGroup = g_form.getDisplayBox('spm_taxonomy_node').value;
alert("product group value in form: " + productGroup);
var ga = new GlideAjax('x_jj_integration.getProductGroupID'); //Scriptinclude
ga.addParam('sysparm_name', 'getProdGrpID'); //Method
ga.addParam('sysparm_prodGroupName', productGroup); //Parameters
ga.getXML(OutputParse);
function OutputParse(response) {
var productGroupID = response.responseXML.documentElement.getAttribute("answer");
if (productGroupID != null) {
alert("Response from the script include:" + productGroupID);
// calling another function in the same script Include
ga.addParam('sysparm_name', 'getProductGroup'); //Assuming you have a function getProductGroup in the same script include
ga.addParam('sysparm_productGroup', productGroupID); //Parameters
ga.getXML(OutParse);
function OutParse(res) {
var v_productGroup = res.responseXML.documentElement.getAttribute("answer");
if (v_productGroup != null) {
alert("Response from the script include:" + v_productGroup);
}
}
}
}
}
If you face issues, request you to share your complete script include code to debug it further.
Thanks & Regards
Amit Verma
Please mark this response as correct and helpful if it assisted you with your question.
