cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
arturdjali
Helper I
Helper I

Creating a lookup column in a list

Hi All,

 

i am trying to create a lookup column for a new list i am creating using the http request. I believe i've got most of it setup but im not sure on the json need to all for multiple fields in this case ID and essionDuration.

 

This is the column i'm trying to replace in flow:

arturdjali_0-1655467654689.png

 

this is how it looks in the flow:

arturdjali_1-1655467757049.png

 

any help is appreciated.

 

thank you 

1 ACCEPTED SOLUTION

Accepted Solutions
Expiscornovus
Super User
Super User

Hi @arturdjali,

 

You can use the FieldRef property in two other requests with the same CreateFieldAs Xml method. You can reuse the Id from the output of your first request to reference the lookup field in your second and third request.

 

Below is an example.

{"parameters":{"__metadata":{"type":"SP.XmlSchemaFieldCreationInformation"},"SchemaXml":"<Field DisplayName='Course: ID' FieldRef='@{body('Send_an_HTTP_request_to_SharePoint')['d']['Id']}' Format='Dropdown' IsModern='TRUE' List='@{variables('LookupListGUID')}' Name='Course: ID' ShowField='ID' Title='Course: ID' Type='Lookup'></Field>"}}

 

createfieldasxml_relatedcolumns.png

 



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


View solution in original post

4 REPLIES 4
Expiscornovus
Super User
Super User

Hi @arturdjali,

 

You could use the CreateFieldAsXml method for the creation of a lookup field. 

 

Try something like below:

 

{"parameters":{"__metadata":{"type":"SP.XmlSchemaFieldCreationInformation"},"SchemaXml":"<Field DisplayName='Course' Format='Dropdown' Indexed='FALSE' IsModern='TRUE' IsRelationship='FALSE' List='@{variables('LookupListGUID')}' Name='Course' ShowField='Title' Title='Course' Type='Lookup'></Field>","Options":12}}

 

createlookupfield.PNG



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


Hi @Expiscornovus ,

 

This works perfectly for creating the lookup column, my only other question what change would i need to make to select columns to show ID and SessionDuration?

 

arturdjali_0-1655720667052.png

Thank you

Expiscornovus
Super User
Super User

Hi @arturdjali,

 

You can use the FieldRef property in two other requests with the same CreateFieldAs Xml method. You can reuse the Id from the output of your first request to reference the lookup field in your second and third request.

 

Below is an example.

{"parameters":{"__metadata":{"type":"SP.XmlSchemaFieldCreationInformation"},"SchemaXml":"<Field DisplayName='Course: ID' FieldRef='@{body('Send_an_HTTP_request_to_SharePoint')['d']['Id']}' Format='Dropdown' IsModern='TRUE' List='@{variables('LookupListGUID')}' Name='Course: ID' ShowField='ID' Title='Course: ID' Type='Lookup'></Field>"}}

 

createfieldasxml_relatedcolumns.png

 



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


@Expiscornovus  Thank you! That does the trick.

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (2,657)