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

 

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

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

 

@Expiscornovus  Thank you! That does the trick.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Users online (3,191)