Everyone must be aware of use of “Dialog Action” choice which is provided by the Sage SalesLogix standard Web Client SDK that can be used while opening a new form on Add button. Has anyone come across a scenario where one can able to open new form through Add button but getting error on click of Save button?
Well, recently while developing a simple Add/Edit form for one of my clients (SLX ver 7.5.3) I came across such a scenario and I feel that I need to share this with you all.
1. I have an entity called Maintenance which has 1 to many relationship with Account
2. I wanted to display a new tab under each Account where users can Add/Edit Maintenance records.
3. To show the Maintenance tab under Account, I created a new entity and table named as AccountMaintenance.
4. To display the tab section I added a new quick form AccountMaintenance under Account entity. On this tab I also provided the Edit and Delete links to Edit/Delete that particular Maintenance.
5. To add a new Maintenance, I added button on toolbar of AccountMaintenance form using “Dialog Action” choice.
6. To open a new page on click of Add button I created a new form AddEditAccountMaintenance under Forms section of AccountMaintenance entity. On this page I provided a Save button so that user can Save all the values.
7. Finally I added both this forms AccountMaintenance and AddEditAccountMaintenance under Smart parts of Account Detail.
8. On AddEditAccountMaintenance screen I am showing only two fields, one field is Month (which is a Picklist) and other one is Maintenance (which is a lookup). Also when I click on Add button a new screen opens and I can select both the values but when I clicked on Save button I am getting the below error.
“not-null property references a null or transient value Sage.SalesLogix.Entities.AccountMaintenance.Account”
9. To check the error I debugged this page in VS and I found that the Parent entity (i.e. Account) values were going blank on click of Save button.
The solution this issue is that “Insert Child Dialog Action” is used to pass the Parent Entity information to the insert form. This action passes the ParentId (Here, in this case AccountId is a ParentId) to the insert form while “Dialog Action” does not. I checked this by removing “Dialog Action” and replacing the same by “Insert Child Dialog Action” it solved my problem.