cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Oskarkuus
Post Prodigy
Post Prodigy

patch connection in dataverse, how?

I am struggling with a patch function to add a new row to table Roadmap_Row Links

 

One column i can not seem to patch.

It is a lookup column.

I cant figure out how to write the patch function for this one.

Oskarkuus_2-1639236838071.png

 

 

Oskarkuus_0-1639236772111.pngOskarkuus_1-1639236793065.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
Oskarkuus
Post Prodigy
Post Prodigy

Thank you both, this lead me in the right direction.

 

The final patch code looks like this and actually works 🙂

 

Patch('Roadmap Row Links';Defaults('Roadmap Row Links');{
    'External Project id': Gal_prj.Selected.Projekt;
    Name: Gal_prj.Selected.Namn;
->> Connection: LookUp('Connection Settings';"https://org38af152c.crm4.dynamics.com"=Url); <<--
    Roadmap: LookUp(Roadmaps;Gal_prj.Selected.Namn = Name);
    'External Project Name': Gal_prj.Selected.Namn;
    'External Project URL': "https://project.microsoft.com/?org=org38af152c.crm4.dynamics.com#/taskgrid?projectId="&Gal_prj.Selected.Projekt;
    'Refresh End Date': DateTimeValue(Text(Now();DateTimeFormat.UTC));
    'Refresh Error Code':0;
    'Refresh Start Date': DateTimeValue(Text(Now();DateTimeFormat.UTC));
    'Refresh Status':0;
    'Status Reason':'Status Reason (Roadmap Row Links)'.Active;
    'Time Zone Rule Version Number':0
})

View solution in original post

3 REPLIES 3
Jeff_Thorpe
Super User
Super User

In the Patch function the Connection column will need to be assigned a record from the associated "Connection Settings" table by using the lookup function.

 

I don't know what your current patch formula looks like or what columns are involved in your case but here is a crude example that may help point you in the right direction. The key takeaway is using the Lookup() to set the value of the Lookup column ("Connection").

 

Patch('Roadmap_Row Links', ThisItem, {Title:"Hello World", Connection: Lookup('Connection Settings', Dropdown.Selected.Value = ID)})



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.
v-qiaqi-msft
Community Support
Community Support

Hi @Oskarkuus,

Could you please tell me that if you use a Combo Box to select lookup value?

Do you want to save data back to Dataverse LookUp column?

 

Actually, you could reference to the main table using the Choices() function or directly reference to the lookup table using TableName.column.

 

If you have a Combo Box, I would suggest the Choices() function.

1). Set the Items property of the ComboBox as below:

Choices(TableName.Connection)

2). Write the Patch() formula as below:

Patch(TableName,Defaults(TableName),{Name:"test",Connection:ComboBox1.Selected})
Best Regards,
Qi
Oskarkuus
Post Prodigy
Post Prodigy

Thank you both, this lead me in the right direction.

 

The final patch code looks like this and actually works 🙂

 

Patch('Roadmap Row Links';Defaults('Roadmap Row Links');{
    'External Project id': Gal_prj.Selected.Projekt;
    Name: Gal_prj.Selected.Namn;
->> Connection: LookUp('Connection Settings';"https://org38af152c.crm4.dynamics.com"=Url); <<--
    Roadmap: LookUp(Roadmaps;Gal_prj.Selected.Namn = Name);
    'External Project Name': Gal_prj.Selected.Namn;
    'External Project URL': "https://project.microsoft.com/?org=org38af152c.crm4.dynamics.com#/taskgrid?projectId="&Gal_prj.Selected.Projekt;
    'Refresh End Date': DateTimeValue(Text(Now();DateTimeFormat.UTC));
    'Refresh Error Code':0;
    'Refresh Start Date': DateTimeValue(Text(Now();DateTimeFormat.UTC));
    'Refresh Status':0;
    'Status Reason':'Status Reason (Roadmap Row Links)'.Active;
    'Time Zone Rule Version Number':0
})

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.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (1,602)