Highlighted
Super Contributor.
Super Contributor.
1065 views

Automatically allocate Approval basis on end user location

Jump to solution

Hi
We have SM 9.50 and upgraded to 9.51

I want SM should automatically assign Approval to end user location basis for service catalog interaction ticket.

For example, end user 'John' having location say 'XYZ' raises service interaction by selecting service catalog item from ESS portal.
And another end user 'Rhian' having location say 'ABC' raises SD from service catalog items via ESS portal.
Now the location 'XYZ' service request managed by SPOC say 'Micheal' and location 'ABC' service request managed by SPOC say 'Ravi' so John requests should goes to to 'Micheal' approval and Rhian request should goes to 'Ravi' approval.

I have created Group 'Approval SR' under approval definition. And added approver 'Micheal' and 'Ravi' under this. Now challenges is what condition i should mention against this approvers so that all users having location 'XYZ' tickets goes for 'Micheal' for an approver and all users having location 'ABC' tickets goes for 'Ravi' for an approver

0 Likes
18 Replies
Highlighted
Super Contributor.
Super Contributor.

Hi -joven-,

1) Yes. The 'contacts' table in which im referring 'location' field. Having almost 200 locations.

2) Since each contacts location im already getting from LDAP So you mean to say without setting any query under FC > login.DEFAULT i would able to see user location using RAD debugger $lo.userlocation

3) Unfortunaltly i checked the same $lo.userlocation however was getting NULL record for location however location is already mapped.

Pls suggest

0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

No, joven, told you about that user wich login in SM get in his environment (using FC-login.default) variable $lo.userlocation, where stored location name of this current user. I suggest the same thing, but calculate this value in the script.

 

if you will use joven's method you should place in Approval Defenition 200 lines of matches LOCATION<->Approver

My method use same data - Location in CONTACTS table for current user, but you just need add new field in LOCATION table (for example let's call it LocApprover) and fill in LOCATION table this field by Approver for each location.

And then in Approver Definition call script to select approver from the table of LOCATIONS based on user location (wich you can calculate in same script or use $lo.userlocation)

 

 

If you get this value as NULL, then show us your FC for login.default (line for $lo.user.location) and then result of command from RAD debugger: d $lo.user.location

Highlighted
Honored Contributor.
Honored Contributor.

I couldn't agree more with ALARMus.

That's a lot of entry to maintain - 200 lines in 1 approval definition - if you want to proceed with that solution. You might as well consider the scripting method of ALARMus.

0 Likes
Highlighted
Honored Contributor.
Honored Contributor.

Check the attached file. 

1. Only define in FC > Lofin.default> Calculations ..........Only 1 entry

add: true

calculation: $lo.userlocation ---- This is just my random Customize variable. You can define what ever you want.

2. Check out the attached Taloja.jpg. That will sum it up.

View solution in original post

Highlighted
Super Contributor.
Super Contributor.

Hi -joven-  and ALARMus,

Thanks lot for your valuable suggestions. Below are the steps followed post which i achieved the requirement.

1) In FC > login.DEFAULT> calculations, added below entry. Please refer attached screenshot 1.

$lo.userlocation=location in $file1

2) In Approval Definition, under condition, below condition triggered to check if end user location is xxx then attach this approval person. Please refer attached screenshot 2.

$lo.userlocation="XXX"

3) Successfully tested by creating service catalog item SD ticket. Please refer attached screenshot 3.

The above steps and screenshots for other reference who wants to achive same requirement.

 

0 Likes
Highlighted
Super Contributor.
Super Contributor.

Wrongly attached 3rd Screenshot

0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Or may be that way

1) Add in Location table new field LocApprover and fill it for each location (Appr_001)

2) Add new Script in Script Library name=MATPATUtils:

 

function GetRecordNamesByQuery(table, query, fieldname)
{	var ret;
	var ff = new SCFile(table, SCFILE_READONLY);
	var sf = ff.setFields(fieldname);
	if (ff.doSelect(query)==RC_SUCCESS)
		{
			ret=eval("ff."+fieldname);
			return ret;	
		}
}

3) In FC for login.Default (Appr_002)

 

Add: true

Calculation: $lo.loc.approver=jscall("MATPATUtils.GetRecordNamesByQuery", "location", "location=$lo.userlocation", "LocApprover")

4) Approval Definition (Appr_003)

 

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.