Sage SalesLogix
  • Contact Us
  • Sage North America
800-643-6400
Welcome Twitter Facebook LinkedIn
Community Home Blogs Share Ideas Search Request Access Resources
Reply
Tuned Listener
mdockins
Posts: 44
Registered: 04-02-2009
Accepted Solution

Defaulting a value on screen load in Saleslogix Mobile

Anyone know how to default a value in a field based on

a) screen load

and

b) a decision/field choice from another field

 

I thought the following would work to default the description field on the edit address screen to 'Mailing' but its not doing anything - any ideas?

 

        Ext.override(Mobile.SalesLogix.Address.Edit, {
            applyContext: function() {
            Mobile.SalesLogix.Address.Edit.superclass.applyContext.apply(this, arguments);
            this.fields['Description'].setValue('Mailing');
            }
        });

 

 

Matt Dockins
www.ppsfirm.com
Please use plain text.
Gold Super Contributor
RJLedger
Posts: 2,234
Registered: 03-19-2009

Re: Defaulting a value on screen load in Saleslogix Mobile

Matt,

 There is additional info (on Mobile) posted on the "partner's" side of the forum under:

  Mobile Developer & Discussion.. suggest you look there.

--
RJ Ledger - rjledger@rjlSystems.net

".. Stay Focused..."
http://www.rjlSystems.net - blog: www.rjlSystems.net/blog.html
Please use plain text.
Employee
tskidmore
Posts: 80
Registered: 07-11-2011

Re: Defaulting a value on screen load in Saleslogix Mobile

@RJL While the other thread helps, this is a special case so I'll go ahead and explain it here.

 

The main issue is that for Address Edit the applyContext function is never called.

 

The Address Edit view flow is:

 

Contact Detail View

Contact Edit View (may query for default values (and call applyContext on itself) or  use passed values)

Address Edit View -- always gets passed the existing value from the previous Edit view. Therefore applyContext never happens since there is no $template request for default values, it always uses the passed values.

 

Meaning if you want to set a default value (to be passed) you would have to do it in the Contact View (and all views that have an address field), something like:

 

Ext.override(Mobile.SalesLogix.Contact.Edit, {
    applyContext: function() {
        Mobile.SalesLogix.Contact.Edit.superclass.applyContext.apply(this, arguments);
        console.log('setting description');
        this.fields['Address'].setValue({'Description':'Mailing'});
    }
});

 

*Note that AddressField stores an object with all the address parts as keys.

 

So for:

a) Typical cases (not EditorFields which AddressField inherits) your approach is correct, using applyContext to provide a direct 'default value' for new insertions.

 

b) Take a peek at Contact/Edit -- in the init() function it binds to the onchange event of the Account field. In the handler, onAccountChange, it sets a field based on a property of the new Account object.

 

Please use plain text.
Tuned Listener
mdockins
Posts: 44
Registered: 04-02-2009

Re: Defaulting a value on screen load in Saleslogix Mobile

Thanks - I suspected something like that (but didn't know how to handle it) when I saw the 'cleanAddressEntry' function on the contact edit - makes sense.

 

I assume this function above is also why my exists validator works at the account level but not at the contact level.

 

Thanks again.

Matt Dockins
www.ppsfirm.com
Please use plain text.
Tuned Listener
mdockins
Posts: 44
Registered: 04-02-2009

Re: Defaulting a value on screen load in Saleslogix Mobile

That did the trick - thanks again.

Matt Dockins
www.ppsfirm.com
Please use plain text.
New Member
GaurangJ
Posts: 2
Registered: 04-19-2012

Re: Defaulting a value on screen load in Saleslogix Mobile

I tried the same thing at my end its giving following error in fire bug.

 

1. missing : after property id
2. Mobile.SalesLogix.Account.Edit is not a constructor
 
I am using follwoing code
 

Ext.override(Mobile.SalesLogix.Account.Edit, {

       applyContext: function() {           

                                                              Mobile.SalesLogix.Account.Edit.superclass.applyContext.apply(this, arguments);

                                                              alert("i m called");

                                                }

                                }),

 

 

Please let me know whats going wrong at my end.

 

Regards,

Gaurang

Please use plain text.