Absent Member.
Absent Member.
1199 views

Location field Error when a User is provided

Jump to solution

Hello Experts,

The Location (amLocation table) field linked to my amPortfolio table is set to Mandatory. Whenever I supply a User (User is mandatory on 'In use' status in my case), I get the following error for the Location field:

Error: Field 'Location (Location)' in table 'SET Equip (amPortfolio)' cannot be empty.

One work-around is to give it ANY location, other than the one it currently has. Save it, then give it the desired location, which works. But that's ridiculous, it should work with the desired location without having to do this work-around. Can anyone help! Any suggestions?

See screenshot attached for a visual explanation (Steps 1 & 2).

Thanks,

- Igor

0 Likes
1 Solution

Accepted Solutions
Highlighted
Absent Member.
Absent Member.

Re: Location field Error when a User is provided

Jump to solution

I was trying my best to avoid using that solution from the very beginning... Well, thank you Mark! I appreciate your guidance.

I was able to figure out another work-around. Instead of the location field, I will do that for the Status field. I created a new Status field & mimicked the behavior of the OOB Status field. Then I set all of the records to "In use" for the seAssignment (Status) field & hid this field (seAssignment).

Now the Location does not disappear anymore because every record is "In use" via the seAssignment field, but I hid it and am using another newly created Status field. Woop Woop..!!!

- IGOR

View solution in original post

0 Likes
13 Replies
Highlighted
Acclaimed Contributor.. Acclaimed Contributor..
Acclaimed Contributor..

Re: Location field Error when a User is provided

Jump to solution

Default value scripts only work upon record creation otherwise a workflow will be needed to keep the location link populated.

0 Likes
Highlighted
Absent Member.
Absent Member.

Re: Location field Error when a User is provided

Jump to solution

Greetings Mark,

If I understood this problem correctly, when a record is created, the lUserId is not 0 & the User.lLocaId has a value that is NOT 0, that's why it works at creation time. But once the status is changed to 'In stock', the User.lLocaId gets updated with a value of 0 (OOB action). Then if I try to re-add a User & since the Location field is Mandatory, the User.lLocaId never gets updated & stays 0. Thus the error of Location being empty (the lLocaId is 0)! I might have not understood everything correctly, but I know it has to do with the lLocaId.

I have created a workflow and it doesn't seem to work.. Please help me! Here is how I did the workflow:

1. Created an Actions script - Context: amPortfolio, Type: Script & the script looks as follows:                                                                            If [lUserId] = 0 Then                                                                                                                                                                                                             Set [lLocaId] = [Parent.lLocaId]                                                                                                                                                                                           Else                                                                                                                                                                                                               Set [lLocaId] = [User.lLocaId]                                                                                                                                                                                         End If

2. Created a workflow - Context of start object: amPortfolio, Start of Workflow (first activity) - Type: Database, Processing: Log event & process immediately, Parameters Tab: Post-Update checked & "Fields monitored.. " is filled in with seAssignment (Status).

Then this invokes the End of Workflow (next activity) - Type: Automatic action, Context: amPortfolio, Parameters Tab: Added the Action script from Step 1.

OR how do you keep the location field populated? Did I write my action script incorrectly or did any of the Workflow steps incorrectly? I followed the Manual & also checked with an OOB workflow called "Delete links between the portfolio items and the location", which is similar to what I need, but not quite.

 

0 Likes
Highlighted
Acclaimed Contributor.. Acclaimed Contributor..
Acclaimed Contributor..

Re: Location field Error when a User is provided

Jump to solution

Let me make sure I understand...

From your first post...
1 - User link on amPortfolio is mandatory when assignment is In-use
2 - Location link on amPortfolio is mandatory - is this always???
3 - Supplying a User causes error stating Location link on amPortfolio cannot be empty
4 - You state the following: One work-around is to give it ANY location, other than the one it currently has. - this is confusing to me as no error should be generated since the Location link on amPortfolio still has a value.

I replied stating default value scripts only work on record creation otherwise a workflow will be needed to keep the location link populated.

You now reply with the following...
1 - ...when a record is created, the lUserId is not 0 & the User.lLocaId has a value that is NOT 0, that's why it works at creation time. - this tells me the Location link on amPortfolio has a default value script to inherit User location (ie. User.lLocaId).
2 - ...But once the status is changed to 'In stock', the User.lLocaId gets updated with a value of 0 (OOB action). - I have never heard of this and should this really be the case?  You may want to consider disabling else how will you get the Location link on amEmplDept to re-populate?  There is a background agent that will clear out the User and Supervisor links on amPortfolio when the assignment changes to In-stock.  This background agent does not remove Location link on amEmplDept or amPortfolio.
3 - ...Then if I try to re-add a User & since the Location field is Mandatory, the User.lLocaId never gets updated & stays 0. - Why would location link on amEmplDept get updated (or removed for that matter)?  And what does this matter for Location link on amPortfolio?  Re-adding a User means assignment is no longer In-stock; else you cannot re-add a User link on amPortfolio (User link on amPortfolio will not display when assignment is In-stock).
4 - ...Thus the error of Location being empty (the lLocaId is 0)! - Yes, modifying the User link on amPortfolio does not auto-generate the related default value script on Location link which is why I replied with needed workflow.


As for the action script called from your workflow, the only issue I see is setting Location link on amPortfolio to PARENT portfolio item record location link; this will still fail if the portfolio item record in question does not have a parent associated.

The oob default value script for Location link on amPortfolio is as follows...
if (0<>[lParentId]) AND (0<>[Parent.lLocaId]) then
  RetVal = [Parent.lLocaId]
elseif (0<>[lUserId]) AND (0<>[User.lLocaId]) then
  RetVal = [User.lLocaId]
elseif (0<>[lStockId]) AND (0<>[Stock.lStockId]) then
  RetVal = [Stock.lLocaId]
end if

Has this default value script been modified?

Writing earlier about PARENT portfolio item, also note, there is another background agent that will keep Location/Stock/Supervisor/User/Assignment same as PARENT for all associated children.

I know this is quite a bit to take in but I want to make sure we are on the same page with your issue.

As for keeping Location link on amPortfolio populated, I would update your workflow action script to mimic the default value script for Location link on amPortfolio.  I would also include lUserId and lStockId as part of the "Fields monitored..." (use commas or select magnifying glass and select each element).

I can see reasons to keep Location link on amPortfolio matched to User/Stock (when no PARENT) as anything else won't make sense (a user location when in-stock and vice versa).  If a PARENT is involved then you never have to worry.  This also means Location link on amEmplDept/amStock must always have a value.

The only other concern you will need to account for is when changing portfolio item assignment to Missing triggers oob workflow "Delete links between the portfolio items and the location".  You should either disable this workflow or modify mandatory attribute for Location link on amPortfolio to NOT be mandatory when assignment is Missing; there is a "Script" option on attribute where logic can be added.

BTW, most background agents are documented under "AutomaticSoftwareMechanisms" pdf guide (found under Docs windows directory of software installation).

Good luck.

0 Likes
Highlighted
Absent Member.
Absent Member.

Re: Location field Error when a User is provided

Jump to solution

Thanks for your detailed reply. I think I understood everything & I did read through that documentation. My replies to your replies:

1 - User link on amPortfolio is mandatory when assignment is In-use YES
2 - Location link on amPortfolio is mandatory - is this always??? YES, ALWAYS (ENABLED IT BY SELECTING YES ON MANDATORY)
3 - Supplying a User causes error stating Location link on amPortfolio cannot be empty YES
4 - You state the following: One work-around is to give it ANY location, other than the one it currently has. - this is confusing to me as no error should be generated since the Location link on amPortfolio still has a value. YES, I AM JUST AS CONFUSED HERE, BECAUSE THE FIELD IS FILLED IN.

The next 1-4 answers:

1 - ...when a record is created, the lUserId is not 0..... CORRECT
2 - ...But once the status is changed to 'In stock', the User.lLocaId..... I WAS WRONG HERE, THE BACKGROUND AGENT CLEARS IT, JUST LIKE YOU SAID.
3 - ...Then if I try to re-add a User & since the Location field... YOU'RE CORRECT
4 - ...Thus the error of Location being empty (the lLocaId is 0)! I UNDERSTOOD THIS & CREATED A WORKFLOW.

Has this default value script been modified? NO, LOOKS JUST LIKE YOURS

About the parent portfolio item. MY RECORDS DO NOT HAVE A PARENT PORTFOLIO ITEM

About the "Delete links between the portfolio items and the location" workflow: DISABLED THIS

Everything in my workflow remained the same except that I added the lUserId and lStockId as part of the "Fields monitored". Changed the action script to look like this (I attached screenshots PDF to help explain my issue).:

if (0<>[lUserId]) AND (0<>[User.lLocaId]) then
  Set [lLocaId] = [User.lLocaId]
elseif (0<>[lStockId]) AND (0<>[Stock.lStockId]) then
  Set [lLocaId] = [Stock.lLocaId]
end if

But it still does NOT work. What did I do wrong? I hope you can help!

Thanks! - IGOR

 

0 Likes
Highlighted
Acclaimed Contributor.. Acclaimed Contributor..
Acclaimed Contributor..

Re: Location field Error when a User is provided

Jump to solution

Based on your screenshot...

Activation conditions - remove seAssignment = 0.

Change 'Fields monitored...' - you have lLocaId but this should be lStockId.  Also remove seAssignment.

Based on your action script logic...

elseif (0<>[lStockId]) AND (0<>[Stock.lStockId]) then - this should be elseif(0<>[lStockId]) AND (0<>[Stock.lLocaId]) then.

 

The workflow will trigger everytime User/Stock changes on amPortfolio.  Since there is no activation condition the workflow will execute immediately and call action script.

I am still concerned regarding "changing User causes error stating Location link on amPortfolio cannot be empty".  This tells me there is something else going on here like another workflow.  I know of nothing oob so if this continues then you will have to investigate more.

Before you test this make sure to re-start the APM service as workflows get cached.  This will update the cache for your new workflow as well as the oob workflow you disabled.

0 Likes
Highlighted
Acclaimed Contributor.. Acclaimed Contributor..
Acclaimed Contributor..

Re: Location field Error when a User is provided

Jump to solution

I forgot to mention...right-click on "Executed" of workflow activity that calls action script and select "Terminal Event" then click Modify button.  This will add another activity and tells the system the workflow is done.

0 Likes
Highlighted
Absent Member.
Absent Member.

Re: Location field Error when a User is provided

Jump to solution

I did exactly as you stated: restarted APM services, added "terminal event," changed activation condition & the script logic, but the same error appears. Is there an option to observe what values get passed as the workflow executes?

Here is what else I observed...

If I disabled the "mandatory" option of the Location field & create a new record with the Location field filled in & the Status "In use" with a User, this works. Once I change the Status to "In stock", location field remains filled in & the User is removed, which is the correct behavior. But once I switch the Status back to "In use" & add a User, then press modify (with the Location field still filled in), this causes the Location field to become blank. Which is why the error gets generated! But I don't see why this is the case. I tried this on an older version of Asset Manager, 9.32 (this version is 9.50), and the same behavior is observed. This also happens in the Web Client.

Thanks for trying to help me out, I greatly appreciate this. But I am now stuck! Is there another method to grab the Location value of that record (the record a User presses on) & just overwrite the Location field again once the User presses "modify" button? Or anything else you can think of?

Thanks,

-IGOR

 

0 Likes
Highlighted
Acclaimed Contributor.. Acclaimed Contributor..
Acclaimed Contributor..

Re: Location field Error when a User is provided

Jump to solution

Stupid question - The User does have a location associated correct?

All I can add is potential timing issue between when the User is changed and Modify button clicked, and when the workflow executes to update Location link.

Regardless of leaving mandatory on Location link (meaning you can set this back if really needed) you will need to change the workflow to "processed by server" (Start trigger event) instead of immediately.  This will let the record be modified (with old Location), workflow will trigger, and then Automated Process Manager (APM) service will execute workflow to completion (with new Location).  This will give the ability for the record to be modified without errors and when the workflow executes it will go against new User/Stock.

APM service utilizes "Execution group" element of workflow (General tab) to determine when workflows execute after being triggered.  Default for no execution group is ten minutes.  If you want the workflow to be executed sooner then you will have to define an execution group on the workflow (ie. every one minute), let APM recognize new execution group (there is an oob scheduled task for this - which I believe is also ten minutes) at which time the APM will auto-create a new related scheduled task (same name execution group defaulted to ten minutes), then you will have to update new APM scheduled task based on time you require (ie. one minute) and restart APM service (stop then start).  Restarting the APM service is done via operating system 'Administrative tools\Services'.

Remember to log in as "service mode" when opening APM (you need to have admin rights).  The new scheduled task can be found under 'Tools\Configure modules...' menubar option.  When you disconnect from APM, because you logged in as "service mode", the APM service will continue even though you are logging out of the APM application.

0 Likes
Highlighted
Absent Member.
Absent Member.

Re: Location field Error when a User is provided

Jump to solution

The User itself does not have a location associated with itself. If I understood you correctly, the User in the Employees table does not have a location value.

But the record does have a Location associated with it, in the amPortfolio table. The reason for the User not having a Location associated to itself is because the User's Location can vary. Sometimes the User uses different Assets from different Locations. On the other hand, the Asset usually has a constant Location and does not change as often.

Another weird observation is that I can change the status to any other option, as long as I don't provide a User & no errors are produced (the location keeps its old value). I also tried this on amComputer table, only to see the same behavior. ONLY when a User is provided, the Location field yells with ANY status...

In regards to using an Execution Group element, I was able to attach the Workflow to an existing Execution Group (BST_SACM) & I changed its time to 1 minute. I waited more than 10 minutes, but the Location field still remains blank (I changed its state to not mandatory for now). Btw, I restarted APM services & logged in as "service mode".

Am I missing something very basic? Is it because the User in the Employees table doesn't have a Location associated with it? I hope we are on the same page. So let me reiterate: all I need is to have the Location field be mandatory at all times, regardless of it having a User or no User. But obviously when the Status is "In use," a User is needed, which is what I need as well. I just don't see why this behavior occurs OOB.

Let me know if you can think of anything else Mark. Thank you for all your explanations.

0 Likes
Highlighted
Acclaimed Contributor.. Acclaimed Contributor..
Acclaimed Contributor..

Re: Location field Error when a User is provided

Jump to solution

So this is not about keeping Location link on amPortfolio updated/populated based on User/Stock???  Then I apologize for sending you down this path.

Ok, going back to your original post...you stated supplying a User causes error message about Location link on amPortfolio cannot be empty.  This means something is causing Location link on amPortfolio to be removed, which causes lLocaId to be zero, which causes error message because Location link on amPortfolio is mandatory.

I know of no background agent that removes location so this tells me there is a workflow that is getting triggered/executed calling an action script to set lLocaId to zero (yes, even if the screen still shows value - need to refresh screen).

This means you will have to review all workflows and determine which one is causing this issue (hint - check the ones with start context of amPortfolio).  Once you identify, you will then have to determine whether workflow should be disabled or logic line commented out from called action script (if this is an oob action script then it will have to be duplicated to make modifications and workflow will have to be associated to duplicated).

It will help if you retain workflow instances so make sure "Do not save instances in the database" checkbox is not checked (General tab).  Yes, restart APM service, test user change, then review "Workflow" tab on amPortfolio screen.

"IF", by some chance, it is NOT a workflow then this means something on the database backend is causing it.

0 Likes
Highlighted
Absent Member.
Absent Member.

Re: Location field Error when a User is provided

Jump to solution

Unfortunately I did not find any workflows causing the lLocaId to be set to 0, I have a total of 17 workflows, 16 were OOB, 1 was added by me for this issue. 7 of the 16 workflows have the Context: "amPortfolio". I looked through the code of all the scripts and none even mention lLocaId or anything pertaining to the Location Update/Deletion. 

When the Assignment is changed to "In stock" from "In use", the User field's value is removed and set to blank. The Location field value is also removed and set to blank. It seems like this is the same background agent or script or whatever it is, that is causing both the User & Location to empty.

I guess I am stuck because I have no idea what could cause it in the backend, since I tested the same scenario on an older version of Asset Manager, with the same outcome.

If you have any other ideas Mark, please let me know becuase it is crucial for our Users using Asset Manager to have a Location. Thanks!

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.