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

Copying A Variable Value Into A Field Form

rsanon
Tera Contributor

We have numerous Catalog Items, where the request type is captured in the variable.

 

For example, "Email" is the Catalog Item, and "New Access", "Group Mailbox", "Distribution List" is captured within a variable.

 

With a business rule, I can copy the value of the variable onto the field on the Requested Item table.

 

current.u_item_type = current.variable_pool.email_access_list.getDisplayValue();

 

The issue I am experiencing however, is how do I expand that business rule?

 

If i have 50 Catalog Items, and I always want the "request type" value to populate into the Requested Item form. How should I go about doing that.

18 REPLIES 18

Aaron40
Kilo Guru

I think I'm a little confused as to what you're doing with the variables. Are you saying you have the same variable across many different catalog forms and you want them to all autopopulate with some information?



If that's the case, what I would do is place that variable in a variable set and include that variable set on all the forms instead of having the variable there manually. Then in the variable set create your script to populate your new variable.


rsanon
Tera Contributor

The variable names are actually different across the board for the Catalog Items.



Say for instance, I have Catalog Item "Email", "Blackberry", "Lync Messaging". Each of these Catalog items have unique request types specific to the item being requested.



Email - New Access, Group Mailbox, Distribution List


Blackberry - User Add, User Removal


Lync Messaging - New User, Modify User



What we want to happen is that the Request type to get populated on the Requested Item form, so for example, for "eMail", if a user selected the choice option "Group Mailbox", that value is captured on a field on the Requested Item form called "Item Type".



I have been able to set the value with this piece of Business Rule:



current.u_item_type = current.variable_pool.email_access_list.getDisplayValue()




But this will only work if the variable names for each request type selection was the same. This unfortunately is not the case.




If I were to add another "current.u_item_type" line, the request type value would not populate on the form






Hi Rachelle,



This is just an idea which i haven't tried myself, perhaps more experienced folks can refer to it:



Each variable has a name and a question. what the user sees on the form is actually the question. what business rules refer to is the name. What if you give all those variables the same name and just change the question text as appropriate for each cat_item?



This way one business rule can take effect on all variables with the same name.


rsanon
Tera Contributor

Unfortunately, the variable names has already been build into some integration code, so updating the variable name, would mean having to update the integration code as well.



Hoping I can still get the results from a business rule.



The "Item Type" field on the Requested Item Form is always populated with the choice value entered at the variable level