Hi Team,
I had a requirement in CA Service Desk in which we had a custom column in pcat object zescalationcode and a same custom column of same data type i.e. string in cr as well. We had a requirement that when an employee save the incident, the zescalationcode field in call_req table gets updated with the value associated with the same column from pcat object depending on the category selected by the employee. For this, in detail_in of employee form, I had created a javascript function as follows:
function myFunction()
{
var var_category=document.main_form.elements["KEY.category"].value;
//alert("Variable is: " + var_category);
<PDM_LIST PREFIX=ci WHERE="delete_flag = 0" FACTORY=pcat>
if (var_category == "$ci.sym")
{
//alert("Value Matched");
document.main_form.elements["SET.zescalationcode"].value="$ci.zescalationcode"
}
</PDM_LIST>
}
I called this function as follows:
<PDM_MACRO name=dtlHier hdr="Incident Area" attr="category" autofill=yes common_name="ss_sym" factory=pcat_in_ss make_required=yes size=30 evt="onChange=myFunction()">
Somehow, it is not updating the zescalationcode field in the cr object. Apart from it, this function is only getting called when we are providing the category value after typing the characters and selecting from auto-fill options. We need that this function gets called even if the employee select the category from the lookup option. When we try to call this function on onBlur event, it is getting called repeatedly and we need to close the browser window to get rid of that.
Kindly provide your suggestion on this or an alternative approach that can make this task easier.
Thanks & Regards,
Balram