Question

Format Exception - Adding Account Address in Opportunity

Hello All,

I am getting an Format Exception (message: Uncaught Expected hex 0x in '{0}'. ) while adding an account address in opportunity. Please find below my code and let me know what could be the reason for this exception. 

Code:

methods:

{

    lookupSelected: function(args)    {
                var scope = this;
                args.selectedRows.each(function(item)    {
                    scope.addAtsAccountAddressInOpportunity(item.Id, item.Address, item.AtsTerm);
                });
            },

            addAtsAccountAddressInOpportunity: function(addressId, name, termId)    {
                var scope = this;
                var insert = this.Ext.create("Terrasoft.InsertQuery", {
                    rootSchemaName: "AtsAccountAddressInOpportunity"
                });
                name = name || "Empty address name";
                var id = Terrasoft.utils.generateGUID();
                insert.setParameterValue("Id", id, Terrasoft.DataValueType.GUID);
                insert.setParameterValue("AtsName", name, Terrasoft.DataValueType.TEXT);
                insert.setParameterValue("AtsOpportunity", this.get("MasterRecordId"), Terrasoft.DataValueType.GUID);
                insert.setParameterValue("AtsAccAddress", addressId, Terrasoft.DataValueType.GUID);
                insert.setParameterValue("AtsTerm",    termId, Terrasoft.DataValueType.GUID);
                insert.execute(function()    {
                    scope.reloadGridData();
                });
           }

}

Like

1 comments

It's a strange exception. Please check the request in a chrome developer tools "Network" tab. I'm sure that you'll find more information. 

The code is technically correct, but you're sending separate insert request and reload grid data for each selected row. I'd use Terrasoft.BatchQuery and reload grid data just once instead.

Show all comments