web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Pages / Problem with Web API c...
Power Pages
Unanswered

Problem with Web API creating record with lookup value

(0) ShareShare
ReportReport
Posted on by 80

Hi,

 

I'm having a problem creating a new record with the web api. I can't get it to work. I've set up table permissions and web roles.

 

I have 2 tables, my_table which has a lookup field in linked_table. My call is as below which is linked to a button click in javascript.

 

 

 webapi.safeAjax({
 type: "POST",
 url: "/_api/my_tables",
 contentType: "application/json",
 data: JSON.stringify({ "my_lookup@odata.bind": "/linked_tables(" + id + ")", 
 "email_field" : "email", "message_field" : "message"}),
 success: function (res) {
 console.log(res);
 }
 });

 

 

Nothing seems to be happening.

 

I'm a bit confused with what to use with plurals and whether to use schema or logical name.

 

Can anyone help?

Thanks

Categories:
I have the same question (0)
  • Fubar Profile Picture
    8,338 Super User 2025 Season 2 on at

    You probably need to be more clear about what you are wanting to do:

    If you look at the examples in the links above they generally use out of the box entities whose schema names are account, contact, and opportunity, task etc (and you'll see the 'plural' - not really plural it is the Entity Set Name see https://learn.microsoft.com/en-us/power-apps/maker/portals/write-update-delete-operations#basic-create )

     

    XrmToolBox also has a Dataverse Rest Builder that can be useful for putting together simple calls (and you can also get an idea from the simple bits how to build more complex ones)

     

     

    •  

     

  • absoluteBeginer Profile Picture
    80 on at

    Thank you, I will take a look. I followed a tutorial on the Microsoft web pages and that seemed to work (again simple case for contact entity). I suspect that either I haven't the correct permissions set up, or my syntax is wrong.

     

    Thanks

  • Fubar Profile Picture
    8,338 Super User 2025 Season 2 on at

    A permission type error will show in the Browsers Console (F12) and the response to the request will show slightly more info than what is in the Console draw. 

  • absoluteBeginer Profile Picture
    80 on at

    Just an update, I seem to have got it working. This link

    PowerApps Portals – Use Web API to Create, Update and Delete records | Hitachi Solutions (hitachi-solutions.co.uk)

     

    was quite helpful. I think I didn't have the correct case on the lookup column name.

     

    Thanks for you help

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Pages

#1
Jerry-IN Profile Picture

Jerry-IN 71

#2
Fubar Profile Picture

Fubar 62 Super User 2025 Season 2

#3
sannavajjala87 Profile Picture

sannavajjala87 31

Last 30 days Overall leaderboard