get rid of extra strings in full name
I am using full name field from system data in my eform and it is giving the value like Lastname, Firstname xxx xxx xxx. Those extra strings (xxx xxx) in my full name are set by my company ploicy. I want to get rid of that extra string after the first name. How do I achieve this??
Any help would be appreciated..
Thanks,
Anil
-
Hi Anil,
you can get the variable in JS with this:
https://documentation.agilepoint.com/00/appbuilder/cloudjsGetFieldValue.html
then modify it
var FullName = result.data.split(" ")[0]+" "+ result.data.split(" ")[1]; //put Lastname and Firstname together
and then put to the control you want with this:
https://documentation.agilepoint.com/00/appbuilder/cloudjsSetFieldValue.html
Feel free to ask further questions!
Regards,
Alexey
-
Thanks Alexey,
I used below JS code to log the field value into the console but it seems didn't worked. It's logging empty data object. Please let me know if I am missing anything in here.
var options = {};
options.fieldId = 'UserName'; // individual control
eFormHelper.getFieldValue (options, function (result)
{
if (result.isSuccess) //check if is success
{
console.log(result.data); //logs the data holds the found control's value
}
else
{
console.log(result.error); //logs the error
}
});
Please sign in to leave a comment.
Comments
2 comments