How to dynamically populate a content type field?


Badge +3

Is there a way to dynamically populate a content type field with a field column value from another list?  I have a list called Implementers which is a list of user's names. I want to do a Query List action in a workflow on a master list called Implementations, and pull in those values to a field in the content type. Then I want all the names to show up in a Request Data action in a choice field, where the user of the workflow task can select one of the choices.  Does anyone know of a way to do this?


11 replies

Userlevel 7
Badge +10

You might be able to do this via PowerShell...

Userlevel 7
Badge +10

There may be a way to set the field via the set field action if the choice field has a specific string format that can be followed for setting it. Let me mock something up real quick to see if this is a possibility.

Userlevel 7
Badge +10

So the issue you are going to run into is that the values are set at a level higher than the actual items. You would need to create a new field and populate it with the choices you want to use. A lookup field might serve better for something like this.

Badge +3

Yes, exactly.  Creating and populating a new field (as part of the workflow task content type or as a field column within the Implementations list) is what I am trying to avoid.  I want a manager to be able to go into the Implementer list whenever necessary and update the list of approvers, instead of me having to manually update the list of implementers in the workflow every time they have personnel changes.  The way the workflow is set up, the manager will not know who the implementer will be until the issue is entered.   Then, in the workflow, the manager uses the content type choice field "Implementer" in the Request Data action to select the correct person.   As I understand it, content type choice fields can only be hard-coded values, correct? There is no way around this?

Userlevel 7
Badge +10

Okay, so.. This can be done with PowerShell... You will need the PowerShell action (can be found here: NTX PowerShell Action - Initial Beta Release )

 

I need to do a bit more testing on this, I will provide a script here shortly.

Badge +17

Nick,

Why not use a SharePoint group and have the manager manage that group?  That way you don't deal with a list and the manager can choose from that group in the implementer field without any issues.

I think saying content type and fields muddy's the conversation by introducing hurdles you don't need to run over or around.  Unless I'm mistaken you want to dynamically update who gets notified to review and approve something. 

Use a SharePoint group for this, and you should be able to get this information into the field you need for the manager to use. 

Userlevel 7
Badge +10

Hey Nick,

Here is the script I mentioned: How to update a choice field in a content type via PowerShell

Cheers!

Badge +3

First of all, thank you Eric and Aaron for your quick and helpful replies!! 

Before I go down the road of doing a PowerShell action, I have one question.   When a choice field containing hard coded values is created in a content type, where is this field stored?    And by that I mean, what table in the NWDB_Content database is that field and field value(s) stored?

Userlevel 7
Badge +10

The field is stored in fields at the site level. The Content Type simply makes a reference to it by ID. Note: When you attach a content type to a list the content type is a copy of the original and as such will not automatically get changes made to the field or Content Type (hence the handling in the provided script to update all instances of the Content Type).

Badge +11

I'd stay away from the choice field. I'd use a lookup instead. That way you can modify the lookup field and it get changed in any item that points to it.

Userlevel 7
Badge +10

Agreed 100%.. I was only offering up the other solution as it was the only way to accomplish it with the requirements provided.

Reply