cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Prashant_k_abs
Level: Powered On

Problem in writing data to Dynamics 365 F&O table from canvas app

I am having trouble while writing data to custom D365 table from a canvas application. I am getting the error "There was a problem saving your changes. The data source may be invalid" in my canvas application. I can able to read the data successfully from same table.

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Problem in writing data to Dynamics 365 F&O table from canvas app

Is it possible that there is some constraint in your table that your App is violating? E.g. a missing mandatory field or duplication of a unique value?

Can you enter your test data directly into the table and check the result as a first step?

3 REPLIES 3
Super User
Super User

Re: Problem in writing data to Dynamics 365 F&O table from canvas app

Is it possible that there is some constraint in your table that your App is violating? E.g. a missing mandatory field or duplication of a unique value?

Can you enter your test data directly into the table and check the result as a first step?

Prashant_k_abs
Level: Powered On

Re: Problem in writing data to Dynamics 365 F&O table from canvas app

I can able to enter the data directly. The only constrain in my table is "Id"(integer) field, which I made it auto increment using following code.

 

public class ABS_PowerApps_User extends common
{
public static int lastId()
{
return (select maxof(Id) from ABS_PowerApps_User).Id;
}

public void insert()
{
if(!this.Id)
{
this.Id=ABS_PowerApps_User::lastId()+1;
}
super();
}

}

Prashant_k_abs
Level: Powered On

Re: Problem in writing data to Dynamics 365 F&O table from canvas app

Thank you Paul. 

 

I have created an index in the table based on the column "Id", which is a mandatory field while inserting a record. I was not passing any value to the Id field from power apps, that is the reason it was failing.