I have a scenario where am using Lookup rules to extract Managers name and email address . I need the email address to use it in the workflow email notification.
The stored proc am using returns the Managers name and the userid in the below format.(in a dropdown field)
Managers
Maria, Lisa -|- lisam
There is a delimiter "-|-" in between the manager's name and user ID. I need to extract the userid from this field (dropdown field in the form) and assign this userid to another field in the form. Once i have the userid in another field i can use that in another lookup rule to extract the email address based on the username from another table.
Can you help me in extracting the username after the delimiter in the above dropdown field in the form.
Am trying to see if the javascript code can help me achive this.
The delimiter is '-|-' without the quotes. That combination is space, dash, pipe, dash, space.
#q1 is the employee id field
#q37 is the dropdownfield with the managername " -|- " username
When user clicks q1 to enter employee id the lookup rule extracts the values for other fields.
Am trying to get the input value of #q37
Extract the string after "- " (dash space)
Am trying to check if the string extracted is correct by displaying the result in alert. And i need to assign that string extracted (userid) to #q38.
This is what i have in javascript so far....
$(function()
{
$('#q1 input').click(function()
{
alert("Test in");
var testStr = $('#q37 input').val();
alert("Value" + testStr);
//Extract the string after '- '+1
var splitStr = testStr.substring(testStr.indexOf('- ') + 1);
alert("Test Substring" + splitStr);
//Set #q38 with the value from var splitStr
$('#q38').val('splitStr');
}
}
));
Thanks!
Any suggestions or answers to my question much appreciated! Thanks!