Showing results for 
Search instead for 
Do you mean 
Community Home Request Access Read Blogs Share Your Ideas Search Community View My Settings
Reply
Highlighted
Nickel Elite Contributor
Posts: 86
Registered: ‎10-21-2009
Accepted Solution

Editing fields in Extension Entity in SLX Mobile3.0

Hi All,

 

I got myself into a strange problem. I have an extension entity of Account. I am trying to bring one of the field from the extension entity to Mobile in detail.js and edit.js.

 

In details.js its working perfectly fine. But, I am having problem in edit page. In edit page neither the value gets populated nor its allowing me to update.

 

I am attaching herewith edit.js for your reference. "'Account_Hydro1/Plant',"--This is the field I want to be editted from Mobile.

 

Thanks in advance.

Malay

Nickel Elite Contributor
Posts: 86
Registered: ‎10-21-2009

Re: Editing fields in Extension Entity in SLX Mobile3.0

Hi All,

 

I am able to display fields from extension entity in Detail page and value entered in this field gets saved from insert screen.

But, when I am trying to edit value of the field from extension entity from the edit view, I am getting following error.

 

- <System>
  <Provider Name="Saleslogix SData Portal" />
  <EventID Qualifiers="0">5033</EventID>
  <Level>2</Level>
  <Task>0</Task>
  <Keywords>0x80000000000000</Keywords>
  <TimeCreated SystemTime="2014-07-11T21:40:30.000000000Z" />
  <EventRecordID>4328971</EventRecordID>
  <Channel>Application</Channel>
    <Security />
  </System>
- <EventData>
  <Data>2014-07-11 16:40:30,453 [28] ERROR ASP.global_asax - Integration Messaging MessagingService unhandled exception [Saleslogix Error Id=SLX44D2E8C88C4D7F41] { "slxErrorId": "SLX44D2E8C88C4D7F41", "mitigation": "AjaxMessagingServiceError (500)", "date": "2014-07-11T16:40:30", "utc": "2014-07-11T21:40:30", "message": "a different object with the same identifier value was already associated with the session: A0Z42A0006KF, of entity: Sage.SalesLogix.Entities.ACCOUNT_HYDRO1.", "source": "NHibernate.Event.Default.AbstractSaveEventListener, NHibernate, Version=3.3.1.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4", "type": "NHibernate.NonUniqueObjectException", "stackTrace": " at NHibernate.Event.Default.AbstractSaveEventListener.PerformSave(Object entity, Object id, IEntityPersister persister, Boolean useIdentityColumn, Object anything, IEventSource source, Boolean requiresImmediateIdAccess)\r\n at NHibernate.Event.Default.AbstractSaveEventListener.SaveWithGeneratedId(Object entity, String entityName, Object anything, IEventSource source, Boolean requiresImmediateIdAccess)\r\n at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.SaveWithGeneratedOrRequestedId(SaveOrUpdateEvent event)\r\n at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.EntityIsTransient(SaveOrUpdateEvent event)\r\n at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.PerformSaveOrUpdate(SaveOrUpdateEvent event)\r\n at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.OnSaveOrUpdate(SaveOrUpdateEvent event)\r\n at NHibernate.Impl.SessionImpl.FireSaveOrUpdate(SaveOrUpdateEvent event)\r\n at NHibernate.Impl.SessionImpl.SaveOrUpdate(String entityName, Object obj)\r\n at NHibernate.Engine.CascadingAction.SaveUpdateCascadingAction.Cascade(IEventSource session, Object child, String entityName, Object anything, Boolean isCascadeDeleteEnabled)\r\n at NHibernate.Engine.Cascade.CascadeToOne(Object parent, Object child, IType type, CascadeStyle style, Object anything, Boolean isCascadeDeleteEnabled)\r\n at NHibernate.Engine.Cascade.CascadeAssociation(Object parent, Object child, IType type, CascadeStyle style, Object anything, Boolean isCascadeDeleteEnabled)\r\n at NHibernate.Engine.Cascade.CascadeProperty(Object parent, Object child, IType type, CascadeStyle style, Object anything, Boolean isCascadeDeleteEnabled)\r\n at NHibernate.Engine.Cascade.CascadeOn(IEntityPersister persister, Object parent, Object anything)\r\n at NHibernate.Event.Default.AbstractFlushingEventListener.CascadeOnFlush(IEventSource session, IEntityPersister persister, Object key, Object anything)\r\n at NHibernate.Event.Default.AbstractFlushingEventListener.PrepareEntityFlushes(IEventSource session)\r\n at NHibernate.Event.Default.AbstractFlushingEventListener.FlushEverythingToExecutions(FlushEvent event)\r\n at NHibernate.Event.Default.DefaultFlushEventListener.OnFlush(FlushEvent event)\r\n at NHibernate.Impl.SessionImpl.Flush()\r\n at Sage.SalesLogix.Entities.Account.Save() in c:\\Users\\administrator.AVANTE\\AppData\\Roaming\\Sage\\Platform\\Output1\\implementation\\Account.cs:line 3018\r\n at Sage.SalesLogix.Entities.Account.Sage.Platform.Orm.Interfaces.IPersistentEntity.Save() in c:\\Users\\administrator.AVANTE\\AppData\\Roaming\\Sage\\Platform\\Output1\\implementation\\Account.cs:line 3132\r\n at Sage.Platform.NHibernateRepository.NHibernateRepository.SaveImpl(Object instance)\r\n at Sage.Platform.NHibernateRepository.NHibernateRepository.Sage.Platform.Repository.IRepository.Save(Object instance)\r\n at Sage.Platform.EntityFactory.Save(Object instance)\r\n at Sage.Platform.SData.RequestHandlerBase`3.SaveEntity(TEntity entity)\r\n at Sage.Platform.SData.RequestHandlerBase`3.InternalPut(SDataUri uri, String ifMatch, TFeedEntry entry)\r\n at Sage.Platform.SData.RequestHandlerBase`3.Put(TFeedEntry entry)\r\n at Invokeba8cc68bc317432ab6ffdcb14716e1bd.Invoke(Object , IRequest )\r\n at Sage.Integration.Messaging.RequestTargetRegistration.RequestTargetInvoker.Invoke(IRequest request)\r\n at Sage.Integration.Messaging.Request.Process(RequestTargetInvoker invoker)\r\n at Sage.Integration.Adapter.AdapterController.RealAdapterController.Process(IRequest request)\r\n at Sage.Integration.Adapter.AdapterController.RealAdapterController.ProcessWorker(IProtocolRequest protocolRequest)\r\n at Sage.Integration.Adapter.AdapterController.Process(IProtocolRequest request)\r\n at Sage.Integration.Messaging.MessagingService.Process(IProtocolRequest protocolRequest)", "targetSite": "System.Object PerformSave(System.Object, System.Object, NHibernate.Persister.Entity.IEntityPersister, Boolean, System.Object, NHibernate.Event.IEventSource, Boolean)", "fullException": "Sage.Common.Syndication.DiagnosesException: a different object with the same identifier value was already associated with the session: A0Z42A0006KF, of entity: Sage.SalesLogix.Entities.ACCOUNT_HYDRO1 ---> NHibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: A0Z42A0006KF, of entity: Sage.SalesLogix.Entities.ACCOUNT_HYDRO1\r\n at NHibernate.Event.Default.AbstractSaveEventListener.PerformSave(Object entity, Object id, IEntityPersister persister, Boolean useIdentityColumn, Object anything, IEventSource source, Boolean requiresImmediateIdAccess)\r\n at NHibernate.Event.Default.AbstractSaveEventListener.SaveWithGeneratedId(Object entity, String entityName, Object anything, IEventSource source, Boolean requiresImmediateIdAccess)\r\n at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.SaveWithGeneratedOrRequestedId(SaveOrUpdateEvent event)\r\n at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.EntityIsTransient(SaveOrUpdateEvent event)\r\n at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.PerformSaveOrUpdate(SaveOrUpdateEvent event)\r\n at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.OnSaveOrUpdate(SaveOrUpdateEvent event)\r\n at NHibernate.Impl.SessionImpl.FireSaveOrUpdate(SaveOrUpdateEvent event)\r\n at NHibernate.Impl.SessionImpl.SaveOrUpdate(String entityName, Object obj)\r\n at NHibernate.Engine.CascadingAction.SaveUpdateCascadingAction.Cascade(IEventSource session, Object child, String entityName, Object anything, Boolean isCascadeDeleteEnabled)\r\n at NHibernate.Engine.Cascade.CascadeToOne(Object parent, Object child, IType type, CascadeStyle style, Object anything, Boolean isCascadeDeleteEnabled)\r\n at NHibernate.Engine.Cascade.CascadeAssociation(Object parent, Object child, IType type, CascadeStyle style, Object anything, Boolean isCascadeDeleteEnabled)\r\n at NHibernate.Engine.Cascade.CascadeProperty(Object parent, Object child, IType type, CascadeStyle style, Object anything, Boolean isCascadeDeleteEnabled)\r\n at NHibernate.Engine.Cascade.CascadeOn(IEntityPersister persister, Object parent, Object anything)\r\n at NHibernate.Event.Default.AbstractFlushingEventListener.CascadeOnFlush(IEventSource session, IEntityPersister persister, Object key, Object anything)\r\n at NHibernate.Event.Default.AbstractFlushingEventListener.PrepareEntityFlushes(IEventSource session)\r\n at NHibernate.Event.Default.AbstractFlushingEventListener.FlushEverythingToExecutions(FlushEvent event)\r\n at NHibernate.Event.Default.DefaultFlushEventListener.OnFlush(FlushEvent event)\r\n at NHibernate.Impl.SessionImpl.Flush()\r\n at Sage.SalesLogix.Entities.Account.Save() in c:\\Users\\administrator.AVANTE\\AppData\\Roaming\\Sage\\Platform\\Output1\\implementation\\Account.cs:line 3018\r\n at Sage.SalesLogix.Entities.Account.Sage.Platform.Orm.Interfaces.IPersistentEntity.Save() in c:\\Users\\administrator.AVANTE\\AppData\\Roaming\\Sage\\Platform\\Output1\\implementation\\Account.cs:line 3132\r\n at Sage.Platform.NHibernateRepository.NHibernateRepository.SaveImpl(Object instance)\r\n at Sage.Platform.NHibernateRepository.NHibernateRepository.Sage.Platform.Repository.IRepository.Save(Object instance)\r\n at Sage.Platform.EntityFactory.Save(Object instance)\r\n at Sage.Platform.SData.RequestHandlerBase`3.SaveEntity(TEntity entity)\r\n at Sage.Platform.SData.RequestHandlerBase`3.InternalPut(SDataUri uri, String ifMatch, TFeedEntry entry)\r\n at Sage.Platform.SData.RequestHandlerBase`3.Put(TFeedEntry entry)\r\n at Invokeba8cc68bc317432ab6ffdcb14716e1bd.Invoke(Object , IRequest )\r\n at Sage.Integration.Messaging.RequestTargetRegistration.RequestTargetInvoker.Invoke(IRequest request)\r\n at Sage.Integration.Messaging.Request.Process(RequestTargetInvoker invoker)\r\n at Sage.Integration.Adapter.AdapterController.RealAdapterController.Process(IRequest request)\r\n at Sage.Integration.Adapter.AdapterController.RealAdapterController.ProcessWorker(IProtocolRequest protocolRequest)\r\n at Sage.Integration.Adapter.AdapterController.Process(IProtocolRequest request)\r\n at Sage.Integration.Messaging.MessagingService.Process(IProtocolRequest protocolRequest)\r\n --- End of inner exception stack trace ---", "hashCode": "FA95BF4E-45240B96-2845ECB3", "pid": 8748, "identity": { "name": "admin", "isAuthenticated": true, "authenticationType": "" }, "version": "8.1.0.1146", "logger": { "level": "ERROR", "location": "Sage.Platform.Diagnostics.ErrorHelper.LogException(:0)", "name": "ASP.global_asax", "message": "Integration Messaging MessagingService unhandled exception [Saleslogix Error Id=SLX44D2E8C88C4D7F41]" }, "request": { "looksLikeAjax": true, "isLocal": true, "method": "PUT", "url": "http://localhost:3333/sdata/slx/dynamic/-/accounts('A0Z42A0006KF')?_includeContent=false&select=AccountManager/UserInfo/FirstName,AccountManager/UserInfo/LastName,AccountName,Account_Hydro1/Plant,BusinessDescription,Description,Fax,Industry,LeadSource/Description,MainPhone,Notes,Owner/OwnerDescription,Status,SubType,Type,User/UserInfo/UserName,WebAddress&format=json&_t=1405114830282", "referrer": "http://localhost:3333/slxmobile/index.html", "ipAddress": "127.0.0.1", "userAgent": "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:29.0) Gecko/20100101 Firefox/29.0", "userLanguages": "en-US; en;q=0.5" }, "browser": { "type": "Firefox29", "name": "Firefox", "version": "29.0", "majorVersion": 29, "minorVersion": 0.0, "platform": "WinNT" }, "server": { "machineName": "HYDRO-SLGX-CLON", "timeZone": "Central Standard Time", "commandLine": "C:\\Windows\\SysWOW64\\inetsrv\\w3wp.exe -ap \"SalesLogix\" -v \"v4.0\" -l \"webengine4.dll\" -a \\\\.\\pipe\\iisipm1550594f-a90e-44c4-bc27-0421bb711ccd -h \"C:\\inetpub\\temp\\apppools\\SalesLogix\\SalesLogix.config\" -w \"\" -m 0", "versionString": "Microsoft Windows NT 6.1.7601 Service Pack 1", "is64BitOperatingSystem": true, "host": { "siteName": "SalesLogix", "applicationId": "/LM/W3SVC/2/ROOT/SData", "applicationPhysicalPath": "c:\\inetpub\\wwwroot\\SData\\", "applicationVirtualPath": "/SData", "isDebuggingEnabled": false, "isHosted": true, "maxConcurrentRequestsPerCPU": 5000, "maxConcurrentThreadsPerCPU": 0 }, "logonUser": { "name": "AVANTE\\webdll", "authenticationType": "", "impersonationLevel": "Impersonation", "isAnonymous": false, "isGuest": false, "isSystem": false } } }</Data>
  </EventData>
  </Event>
 
So apparently, its creating a new extension entity, where as it should update.
 
If anyone here came across such situation please reply.
 
Thanks
Malay
Nickel Elite Contributor
Posts: 86
Registered: ‎10-21-2009

Re: Editing fields in Extension Entity in SLX Mobile3.0

Hi All,

 

I need to figure this out badly. Any suggestions will be appreciated.

 

Thanks

Malay

Employee
Posts: 7
Registered: ‎07-08-2008

Re: Editing fields in Extension Entity in SLX Mobile3.0

Here is an example of accessing an extension from the edit form... I hope this is what your looking for.

//-----------------------------------------------------------------------------------------------------

 

define('Mobile/Training/Views/ClientProject/Edit', [

    'dojo/_base/declare',

    'dojo/string',

    'Mobile/SalesLogix/Validator',

    'Mobile/SalesLogix/Format',

    'Mobile/SalesLogix/Template',

    'Sage/Platform/Mobile/Edit'

], function(

    declare,

    string,

    validator,

    format,

    template,

    Edit

) {

 

    return declare('Mobile.Training.Views.ClientProject.Edit', [Edit], {

        //Localization

        titleText: 'Title',

        descriptionText: 'Description',

        startdateText: 'Start Date',

        enddateText: 'End Date',

        accountText: 'Account',

 

        //View Properties

        entityName: 'ClientProject',

        id: 'clientproject_edit',

        insertSecurity: 'Entities/ClientProject/Add',

        updateSecurity: 'Entities/ClientProject/Edit',

        querySelect: [

           'Title',

                           'Description',

                           'StartDate',

                           'EndDate',

                           'Account/AccountName',

                           'CreateUser',

                           'Test'

        ],

        resourceKind: 'clientprojects',

                        includeIfValueExists: function(value) {

            return value;

        },

                        applyContext:  function() {

                                    var found = App.queryNavigationContext(function(o) {

                                                return /^(accounts)$/.test(o.resourceKind) && o.key;

                                                });

                                    var lookup = {

                                                'accounts': this.applyAccountContext

                                                };

                                               

                                                if (found && lookup[found.resourceKind])

                                                lookup[found.resourceKind].call(this, found);

                                                },

                                                applyAccountContext: function(context) {

                                                            var view = App.getView(context.id),

                                                                        entry = view && view.entry;

                                                            var accountField = this.fields['Account'];

                                                                        accountField.setValue(entry);

                                                            },

                       

        createLayout: function() {

            return this.layout || (this.layout = [{

                label: this.titleText,

                name: 'Title',

                property: 'Title',

                type: 'text',

                validator: validator.hasText

            },{

                label: this.descriptionText,

                name: 'Description',

                property: 'Description',

                type: 'text',

                maxTextLength: 200,

                validator: validator.exceedsMaxTextLength

            },

                                    {

                                                label: this.startdateText,

                                                name: 'StartDate',

                                                property: 'StartDate',

                                                renderer: Mobile.SalesLogix.Format.date,

                                                type: 'date'

                                    },

                                    {

                                                            name: 'CPExt.$key',

                                                            property: 'CPExt.$key',

                                                            type: 'hidden',

                                                            include: this.includeIfValueExists

            },

                                    {

                                                label: 'Test',

                                                name: 'CPExt.Test',

                                                property: 'CPExt.Test',

                                                type: 'text'

                                    },

                                    {

                                                label: this.enddateText,

                                                name: 'EndDate',

                                                property: 'EndDate',

                                                renderer: Mobile.SalesLogix.Format.date,

                                                type: 'date'

                                    },

                                    {

                                                label: this.accountText,

                                                name: 'Account',

                                                textProperty: 'AccountName',

                                                type: 'lookup',

                                                requireSelection: true,

                                                validator: Mobile.SalesLogix.Validator.exists,

                                                view: 'account_related'

                                    }]);

        }

    });

});