Creating a case in a mobile app using the Mashup SDK for iOS
You use the Mashup SDK in a native iOS app to display an embedded Pega® Platform application in a hybrid web view. The Mashup SDK allows a user to create a case, open an existing case, show a harness, open an assignment, or run an activity in a mobile environment. For example, if a native iOS app is used as a custom application to support plant maintenance, a user can create a case in a hybrid web view to report failing machinery.
Prerequisites
Before you continue, make sure that you have set up the Mashup SDK for an iOS app development. Make sure that you also have access to the documentation that is included with the Pega Mashup SDK distribution package.
Authenticate to the Pega Platform
Before you create a case in a Pega Platform application, you must authenticate with Pega Platform. Use the PMSnapStartLoginController controller to log in to a Pega Platform instance. You use an existing storyboard in your iOS app to display a login screen. To authenticate with Pega Platform, enter your Pega Platform user name and password.
- In the Interface Builder, open the main storyboard of an iOS app.
- Open or create a scene that allows the user to navigate to the authentication scene.
- Add an object to the scene that you use to initiate the login process, for example:
- From the Object Library, drag a Button object to the canvas.
- In the Attributes inspector, change the name of the button to, for example, .
- From the Object Library, create the authentication scene by dragging a View Controller object to the Interface Builder.
- In the Outline view of the Interface Builder, click the View Controller icon, and in the Identity inspector, set the custom class of the view controller to PMSnapStartLoginController.
- In the Attributes inspector, set the Server URL field to the Pega Platform endpoint URL.
The URL address must be specified in the following format:
http://<SERVER_NAME>:<PORT>/prweb/
- From the Object Library, create two text fields by dragging a Text field object from the Object Library to the authentication scene.
- From the Object Library, drag a Button object to the authentication scene. In the Attributes inspector, change the name of the button to .
- In the Outline view of the Interface Builder, right-click the Snapstart Login View Controller icon to display the list of available outlets.
- Connect the
username
andpassword
outlets to the two text fields that you added to the authentication scene. - Connect the
loginButton
with the button that you added to the authentication scene. - Connect the button to the authentication scene, and select menu.
Create a case in a hybrid web view
Use the PMSnapStartCreateCaseController controller to create a case in an embedded Pega Platform application screen as a hybrid web view.
- From the Object Library, create the case scene by dragging a View Controller object to the Interface Builder.
- In the Outline view of the Interface Builder, click the View Controller icon and in the Identity inspector, set the custom class of the view controller to PMSnapStartCreateCaseController.
- In the Attributes inspector, set the Class name field to the name of the case, for example, Wb-MachineryIssue-Case.
- Right-click the Attributes inspector, change the name of the button to . button and in the
- Connect the button to the create case scene and select menu.
- Select the action segue and in the Attributes inspector, change the identifier of the action segue to .