freddie3399
Scholar

Auto assign value from another list in sequence

Jump to solution

Hi,

 

I have a list with field Name, Location & Vendor - Call it list A

 

I have another list with all the Vendors information with field Location & Vendor Name - Call it list B

 

I want to build a workflow when user create new item --> fill up Name and Location --> workflow started --> AUTOMATIC PICK UP THE VENDOR NAME BASED ON THE VENDOR'S LOCATION FROM LIST B AND ASSIGNED IT TO THE FIELD VENDOR IN LIST A. 

 

example: 

List A

Name: ProjectA

Location: LocationA

Vendor: Disabled for edit

 

List B

Location Vendor Name
A John
A Angel
A Cat
B John
B Bowie

 

workflow

when user fill up Name and location, go to list B, sort location based on the input by user in this case is A and return the vendors available which are John, Angel and Cat. From these 3, select one of them randomly/by sequence. Once obtain the value, assign it to the list A Vendor field. 

 

0 Kudos
Reply
5 Replies
Tarf
Explorer

Re: Auto assign value from another list in sequence

Jump to solution

Hi,

what exactly are you struggling with?

You can get all the available vendors using "Query List" Action
Get Items from: List B
Where: ItemProperty:Location = Location (Column in List B)
Field: Vendor Name -> some_collection_variable

After that, you can - according to your needs - pull out one of the vendors. What comes to mind first, as I don´t know how to create random numbers in workflow, is using the modulo operator on the item ID.

Something like this for "pseudo-randomness"

  1. Collection Operation
    Target:Collation: some_collection_variable
    Operation: Count
    Store result in: some_number_variable
  2. Math operation
    Workflow Data: some_number_variable MOD ListLookup:CurrentItem:ID
    Store result in: some_number_variable (you can reuse the variable)
  3. Collection operation
    Target: some_collection_variable
    Operation: get
    Store result in: some_text_variable
  4. Update Vendor field by some_text_variable
0 Kudos
Reply
freddie3399
Scholar

Re: Auto assign value from another list in sequence

Jump to solution

Hi Tarf, 

 

Thanks for trying to help! 

 

I'm a total newbie in Nintex workflow and struggling with building a workflow with only very little knowledge on this. I've tried your method and it works until number of item in list A exceeded the count number in the collection operation. 

 

I've only maximum 5 items after query in list B. But I will have more than 100 items in List A. 

 

Trying to solve myself by modifying the neither the collection operation nor math operation but no luck. 

 

Could you advise again? Appreciate it!

0 Kudos
Reply
freddie3399
Scholar

Re: Auto assign value from another list in sequence

Jump to solution

This is the error message I have received

 

Error operating on collection variable. Index property is greater than the number of items in the collection

0 Kudos
Reply
Tarf
Explorer

Re: Auto assign value from another list in sequence

Jump to solution

Hi @freddie3399.,

sorry my bad, I got the variables in the mod operation in wrong order.

You should do
ItemProperty:ID MOD collection_count (e.g. some_number_variable).

Edit: 

Variables where in the correct order, what does a "log in workflow history" say about the number of items (after count) of the collection?

Edit 2:

Turns out I actually got the variables in the wrong order. So

ItemProperty:ID MOD collection_count (e.g. some_number_variable) is correct, sorry!

0 Kudos
Reply
freddie3399
Scholar

Re: Auto assign value from another list in sequence

Jump to solution

Hi @Tarf ,

 

It works like a gem! Thank you so much

0 Kudos
Reply