The CreatorCon Call for Content is officially open! Get started here.

Auto-populate CI of current logged user (Caller) on Incident form after the form is submitted from Record Producer

osni seca
Kilo Expert

Hi all

I guess this has been achieved but I can't find a way to get it to work based on what I have seen so far.

I have a Record Producer where users can log Incidents. However, when users submit the form [from the Record Producer], the Configuration Item do not auto-populate on Incident form - which is what I want to achieve

Can i get some help!? Hint!!??

 

OS

 

7 REPLIES 7

Thanks for sharing your form. Mine is:

 

Variables

Var 1: Is this request/incident for someone else?

    No: 

    Yes: if yes is selected [Var 3 shoes up]

Var 3: The name of the user

Field 4: Summary:

Field 5: Full Description:

 

Note: I will create another variable where I ask users to confirm [by typing manually] the affected machine number they are having issues with.

 

The reason I want to auto-populate CI for current logged users:

By having an auto-populated CI on INC form when user submit the form I can compare what is currently in cmdb against the info [affected machine] user have typed in.

 

OS

 

Service_RNow
Mega Sage

Hey Osni,

There's only a few things that can be acting on the data once it's been submitted. You're going through a Record Producer, so I'd check the Script on the Record Producer (in the "What it will contain" section). By default, the "Create Incident" out-of-box record producer script looks like:

var isMobile = GlideMobileExtensions.getDeviceType() == 'm';

var link = isMobile ? '#/!list/incident/q:active=true%5Ecaller_id=javascript:gs.user_id()%5EEQ' : 'home.do';

var s = 'This incident was opened on your behalf<br/>';
s += 'The IT department will contact you if they need any further information<br/>';

if (isMobile)

      s += 'You can track status from this <a href="' + link + '">List</a> <br/>';
else
      s += 'You can track status from the <a href="' + link + '">Homepage</a> <br/>';
gs.addInfoMessage(s);
current.contact_type = 'self-service';
current.caller_id = gs.getUserID();
if (producer.comments.length > 80)
      current.short_description = producer.comments.substring(0, 79);
else
      current.short_description = producer.comments;
 

 

Line 13 shows the caller being set to the currently-logged-in user. If you copied this producer's script, and modified it for your needs, you may have missed that line.

 

After it goes through this script, the only other thing acting on the submitted Incident before it gets saved to the database will be business rules. You can set a Before business rule with a really low order, on Incident, Before insert, which simply logs the caller_id. That will tell you wether the caller_id is getting changed *before* business rules are invoked, or after/during business rule processing.

 

Please mark reply as Helpful/Correct, if applicable. Thanks!

Hummm...interesting

Maybe if i have a CI field being populated in Record Producer itself it would be easier. 

 

To make it simple:

 - For current logged users I would have a field displaying [or auto-populating] their CI (The CI in Record Producer would be mapped to CI on INC form) - Variable [reference to cmdb_ci_computer]

- I then would ask them to confirm if the CI [above] is the correct one - Variable  [string]: 

 

I would be happy to achieve just that. Possible?

 

Note: in my company have strictly policy - one user, one machine. However, sometimes there are conflicts between cmdb [what is assigned_to] and what users actually are using

 

Hope it makes sense to you and thanks for the support

 

OS