Create a generic alert message on the user table

SMuir
Mega Guru

Can someone help me with this query please.

We want to create a generic alert message that can be changed.

For example.

Create a tick box called Alert message

Create a text field to show when the alert message has been ticked on a certain user.

Enter the message for example. Blackberry pilot

When a Service Desk Analyst logs a call and selects the user. It will display a message Blackberry Pilot.

If the same tick box and a different message is applied on another user in the user table. Say the message is Laptop pilot it will show that message.

Does anyone know if this will work or done something similar? for example if someone is part of two pilots how can the message be applied?

Kind Regards

Sarah

1 ACCEPTED SOLUTION

Hi Sarah,



I'll assume you have a field on your table called u_active which is a true/false field. You can add that to your script include query (before the msg.query() statement) something like this:



msg.addQuery('u_active', true);



If my assumptions are incorrect, adapt the statement or let me know the field name, type, value, etc. and I can advise.



Thanks.


View solution in original post

25 REPLIES 25

I'm sorry, Sarah - I meant 33, not 23.


Ask the Expert: GlideAjax - TechNow Ep 33



The code for this episode is available on the GitHub repository noted at the top of the posting. Sorry for the confusion.


Thanks Chuck, I will take a look and try.


Hi Chuck



I have watched the technow33 but I am not sure how I can adapt it for my needs. Something is definitely not right, I am unable to save the script include and not sure how I can amend it. Or if what I have written is even right.



Are you able to help?



Here's what I have done so far




1. Created a table — Table name - u_user_alert



2. Added field — User | reference | sys_user



3. Added field alert message | string



4. Added the related list to the user table



5. Added entry's in the alert message field Consultant fee earner and Blackberry Pilot to User Sarah Muir



6. Created Client Script (not sure if this is right though)


function onLoad() {


var user = g_form.getValue('sys_user');


var glideajax= new GlideAjex('MessageMapper');


ga.addParm('sysparm_name', 'getUser');


ga.addParm('sysparm_msgVal', u_user_alert);


ga.getXMLAnswer (alertMessageback);



function alertMessageback(answer){


alert(answer);


}


}




7. Created script include


var MessageMapper = Class.create();


MessageMapper.prototype =


Object.extendObject(global.AbstractAjaxProcessor,


}


},


type: 'MessageMapper'


});


Could not save record because of a compile error: JavaScript parse error at line (18) column (10) problem = missing ) after argument list (; line 18)



And it won't let me save the script include. I copied the script



Can you remove type and check...I never needed "type"


Thanks for the reply.



I have removed type and it seems to like that.



But still won't let me save it I'm getting an error on line19 now



var MessageMapper = Class.create();


MessageMapper.prototype =


Object.extendObject(global.AbstractAjaxProcessor,


}


},


'MessageMapper'


});



Could not save record because of a compile error: JavaScript parse error at line (19) column (1) problem = missing ) after argument list (; line 19)