insert new record using X++

Hello,

I added a new tab in CustParameters from, the added tab contains a grid.
y problem I can not create new records in this grid may be the reason is that the form "new" toolbar is disabled.

Can I add the record using X++? please paste the code.
smetechitAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

agusacilCommented:
Hi,

Parameter form normally have only single record. Do you add new table or add new fields to the CustParameter table?
If you add a new table then you need to set Grid's data source property to the data source of your new table to allow creating new record.

Add record through X++ (copied from dev help ):
CustTable custTable;
;
ttsBegin;
  
select forUpdate custTable;
custTable.AccountNum = '5000';
custTable.Name = 'MyCompany';
custTable.insert();
  
ttsCommit;

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
agusacilCommented:
Hi,

Thanks. I am not sure which one eventually you did. For additional note, the code above assuming some fields value are defaulted from existing record. To get a clean new record you should do this :

CustTable custTable;
;
ttsBegin;
  
custTable.clear()
custTable.AccountNum = '5000';
custTable.Name = 'MyCompany';
// Assign other fields here, especially mandatory fields.
custTable.insert();

Open in new window

 
ttsCommit;
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Dynamics

From novice to tech pro — start learning today.