01.06.2013 Views

OpenEdge Development: Mobile Applications - Product ...

OpenEdge Development: Mobile Applications - Product ...

OpenEdge Development: Mobile Applications - Product ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

3. In the Event menu, select Load.<br />

4. In the Action menu, select Run JavaScript.<br />

Creating the <strong>Mobile</strong> App<br />

5. In the JavaScript editor that appears, copy and paste the following code:<br />

var settings;<br />

try {<br />

/* CHANGE THIS TO POINT TO YOUR SETTINGS SERVICE */<br />

settings = My<strong>Mobile</strong>Service_dsCustomer_Settings;<br />

pdsession = new progress.data.Session();<br />

var loginResult =<br />

pdsession.login(settings.serviceURI,"","");<br />

if (loginResult != progress.data.Session.LOGIN_SUCCESS) {<br />

console.log('ERROR: Login failed with code: ' + loginResult);<br />

switch (loginResult) {<br />

case progress.data.Session.LOGIN_AUTHENTICATION_FAILURE:<br />

cMsg = 'Invalid user-id or password';<br />

break;<br />

case progress.data.Session.LOGIN_GENERAL_FAILURE:<br />

default:<br />

cMsg = 'Service is unavailable';<br />

break;<br />

}<br />

}<br />

} catch (e) {<br />

cMsg = "Failed to log in";<br />

console.log(e.stack);<br />

}<br />

if (cMsg != "ok") {<br />

alert(cMsg);<br />

return;<br />

}<br />

pdsession.addCatalog(settings.catalogURI);<br />

6. Click Add event.<br />

<strong>OpenEdge</strong> ® <strong>Development</strong>: <strong>Mobile</strong> <strong>Applications</strong> 55

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!