This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Check User Account exists on another object

Hi, I need to use some workflow state action script to validate if a selected 'Owner' is listed in an Organisation


Organisations are tagged with 'M-Files User' property, which is a multi-select from the User account value list

The workflow process objects we're creating will be have a single-select 'Owner' property, which is again selecting from the User account value list


Normally I'd do this in script with something like this code:

 

' Get all the Organisations from the Delivery Team
Dim OrgLOOKUPS : Set OrgLOOKUPS = DTPropVal.SearchForProperty(pOrg).TypedValue.GetValueAsLookups

' Start Organisation lookups 
Set OrgObjID = CreateObject("MFilesAPI.ObjID")
OrgObjID.Type = otOrganisation

' Get details for each Organisation 
Dim Orglookup : Set Orglookup = CreateObject("MFilesAPI.Lookup")
Dim OrgObjVer : Set OrgObjVer = CreateObject("MFilesAPI.ObjVer")
Dim OrgPropVal : Set OrgPropVal = CreateObject("MFilesAPI.ObjectVersionAndProperties") 

For Each Orglookup in OrgLOOKUPS
	If Orglookup.item = SelectedOrg Then
		IsOwnerInDT = 1
		Exit For ' Stop the For loop, a match has been found
	End If
Next 

But the problem is on line6, where I'd define the Object Type of my lookup - I can't do this with Users as they're not objects, they're entries in the Value List

How would I do this, instead then?
Many thanks

Parents
  • Hi Spooky,
    Are you trying to stop a user/owner from being selected on more than one organisation?
    If so, have you looked at the configuration accelerators using unique object enforcement with the owner property set as the unique property?

Reply
  • Hi Spooky,
    Are you trying to stop a user/owner from being selected on more than one organisation?
    If so, have you looked at the configuration accelerators using unique object enforcement with the owner property set as the unique property?

Children
No Data