Maximo

Maximo

Come for answers, stay for best practices. All we're missing is you.

 View Only
  • 1.  How to reference an image (company logo) in SRMOBILE and start hierarchy from second level in Application Framework?

    Posted Mon November 10, 2025 09:12 AM

    Hi everyone,

    I'm currently working on customizing the SRMOBILE application in Maximo and have a couple of questions regarding configuration through the Application Framework - specifically app.xml and appCustomization.js.

    1. Image referencing:

      • How can I reference an image (like the company logo) that's hosted online within the SRMOBILE app?

    2. Hierarchy starting point:

      • Is there a way to start the location hierarchy from the second level instead of the first (for example, skipping the root and showing only sub-locations)?

      • Can this be achieved through the framework configurations, or does it require deeper customization in the application code?

    Additionally, I'm implementing several UI adjustments such as:

    • Save my GPS in the service address is not working.

    • make attachments required before submitting requests.

    Any insights or best practices on handling these through the framework would be greatly appreciated 

    Thanks in advance!



    ------------------------------
    Mostafa Mosaad
    Software Engineer
    Megasoft
    Cairo
    01117275779
    ------------------------------


  • 2.  RE: How to reference an image (company logo) in SRMOBILE and start hierarchy from second level in Application Framework?

    Posted Mon November 10, 2025 05:29 PM

    Hi Mostafa - great questions. You can do most of this via the Application Framework (app.xml + appCustomization.js), and only drop to "deeper" customization if you hit limits.

    1) Referencing an online image (e.g., company logo)

    Best practice: bundle the image with the app; it works offline and avoids CORS.

    • Put your file at: apps/SRMOBILE/common/images/logo.png

    • In app.xml (or a custom CSS), reference it:

    <image id="companyLogo" src="images/logo.png" />

    or in CSS:

    .company-logo { background-image: url("images/logo.png"); }

    If you must load from a URL:

    • Add the host to the Cordova/Worklight whitelist (config.xml / application-descriptor.xml):

    <access origin="https://assets.yourdomain.com" subdomains="true" />
    • Ensure the server sends proper CORS headers and uses HTTPS.

    • Remember: this won't show when the device is offline. For guaranteed display, consider a Base64 data URI:

    <image id="companyLogo" src="data:image/png;base64,...." />

    2) Start the location hierarchy from "second level"

    You have two clean options without code changes to core files:

    A. Saved Query approach (recommended):

    1. In Maximo (LOCATIONS), create a public saved query that excludes the root, e.g.
      parent is not null (or parent='YOURROOT' to show only children of a specific root).

    2. Expose it over OSLC and set your lookup/list in app.xml to use that queryBase:

    <lookup id="locationLookup" resource="LOCATION" queryBase="CHILD_ONLY" <!-- your saved query name --> ... />

    B. Additional WHERE in the control:
    If you're already using a queryBase, add a filter:

    <lookup id="locationLookup" resource="LOCATION" queryBase="ACTIVE" additionalWhere="parent is not null" />

    (Use whichever attribute your Anywhere version supports: additionalWhere, defaultFilter, or a filter binding.)


    3) "Save my GPS in the Service Address" not working

    Common causes & fixes:

    • Permissions: ensure the mobile OS has Location permissions enabled for the app.

    • Security: the user's security group needs create/update on SERVICEADDRESS (and related SR → Service Address relationship).

    • App config: confirm service address features are enabled in app.xml and that the SR app is set to persist the address.

    • Attribute mapping: Service Address typically has LATITUDE / LONGITUDE. Make sure your handler sets those on the related Service Address record, not just on SR.

    Example hook in appCustomization.js:

    define(["dojo/_base/lang", "platform/translation/MessageService", "platform/comm/_ConnectivityChecker", "platform/geolocation/GeoLocationHelper"], function(lang, MessageService, _ConnectivityChecker, GeoLocationHelper) { return { setGPSOnServiceAddress: function(eventContext) { var sr = eventContext.application.getResource("sr").getCurrentRecord(); return GeoLocationHelper.getCurrentLocation().then(function(loc){ // Create or get related Service Address var sa = sr.get("serviceaddress") || sr.createNewRelationshipRecord("serviceaddress"); sa.set("latitude", loc.coords.latitude); sa.set("longitude", loc.coords.longitude); // set other SA fields as needed, e.g. addressline1 from reverse geocode if you have it }).otherwise(function(err){ eventContext.application.showMessage(MessageService.createStaticMessage("Could not get GPS").getMessage()); }); } }; });

    Then wire setGPSOnServiceAddress to your "Save my GPS" UI action.


    4) Make attachments required before submitting the SR

    Add a lightweight validation hook in appCustomization.js:

    define(["dojo/_base/declare", "application/business/SR"], function(declare, SR){ var orig = SR.prototype.validateBeforeSave; SR.prototype.validateBeforeSave = function(eventContext){ var ok = true; if (orig) ok = orig.apply(this, arguments); if (!ok) return false; var srSet = eventContext.application.getResource("sr"); var sr = srSet && srSet.getCurrentRecord(); var atts = sr && sr.getPendingOrOriginalValue && sr.get("attachments"); var count = (atts && atts.count) ? atts.count() : 0; if (count === 0){ eventContext.application.showMessage("Please attach at least one file before submitting."); return false; } return true; }; });

    When you'd need deeper customization

    • If your hierarchy needs dynamic "second level" logic per site/org (not just parent is not null), inject the parent programmatically from user/site context in appCustomization.js and set a runtime filter on the lookup.

    • If the logo must be pulled from a tenant-specific URL at runtime, add a small handler that selects the src based on org/site and caches it locally.

    If you share your Anywhere/Mobile version (e.g., 7.6.4.x vs MAS Maximo Mobile) and whether SRMOBILE is the classic Anywhere SR app or the MAS Mobile SR, I can tune the exact control attributes and handler names for your build.

    - Manu Nagayach
    IBM-Certified Maximo Architect | EAM Strategist



    ------------------------------
    Manu Nagayach
    ------------------------------



  • 3.  RE: How to reference an image (company logo) in SRMOBILE and start hierarchy from second level in Application Framework?

    Posted Tue November 11, 2025 01:40 AM

    Hi Manu,

    First of all, thank you so much for taking all this time and sharing such detailed, valuable insights - along with the code snippets and best practices. This means a lot to a learner like me! I truly appreciate the clarity and depth of your explanations - it's rare to get guidance that's both conceptual and hands-on at the same time.

    For context, I'm currently running on MAS 9.1 with SRMOBILE 9.1.6, and my system information is:

    • Version Graphite build version: 3.1.590

    • Configuration version: 1.7.29

    Your notes on image handling, location hierarchy filtering, GPS saving, and attachment validation were extremely insightful - especially the practical hooks and where to extend them safely without breaking the framework.

    Thanks again for your time, effort, and generosity in sharing your expertise. It really helps learners like me build confidence and a deeper understanding of Maximo Mobile customization.

    Warm regards,
    Mostafa



    ------------------------------
    Mostafa Mosaad
    Software Engineer
    Megasoft
    Cairo
    01117275779
    ------------------------------



  • 4.  RE: How to reference an image (company logo) in SRMOBILE and start hierarchy from second level in Application Framework?

    Posted Tue November 11, 2025 08:24 AM
    Edited by Manu Nagayach Tue November 11, 2025 08:24 AM

    @Mostafa Mosaad You're welcome!



    ------------------------------
    Manu Nagayach
    ------------------------------



  • 5.  RE: How to reference an image (company logo) in SRMOBILE and start hierarchy from second level in Application Framework?

    Posted Wed November 12, 2025 03:42 AM

    Hi Manu,

    Quick update - I'm now working on the location hierarchy piece.

    Goal: on the SR form's Location tab (the drill-down tree), I want the picker to start from the second level. In our case that second level consists of two specific top locations, so users should only see children under those two nodes (and not the single root). so MD (top location) have MA and MB and i want these 2 to appear as the top in the location drilldown tab in the SR Form

    What I tried:

    • Added a filter on the datasource override

      <maximo-datasource-override id="locationHierarchyDS" lookup-data="true" offline-immediate-download="true" page-size="15" where="parent is not null"/>

    It triggered an OSLC error in the app.

    Does locationHierarchyDS support where for the tree in 9.1.6 And for the OSLC error, is there anything specific I should watch for on the hierarchy resource

    Thanks again - once I get this piece stable I'll circle back on the other tweaks.



    ------------------------------
    Mostafa Mosaad
    Software Engineer
    Megasoft
    Cairo
    01117275779
    ------------------------------



  • 6.  RE: How to reference an image (company logo) in SRMOBILE and start hierarchy from second level in Application Framework?

    Posted Fri November 14, 2025 06:35 AM

    Hello @Manu Nagayach,

    I hope you are doing well,

    Thanks again for all your help on this thread – I'm still working through a few pieces in SRMOBILE 9.1.6 (MAS 9.1) and wanted to share where I am and ask for a bit more guidance.

    1) Location hierarchy / locationHierarchyDS
    I tried overriding locationHierarchyDS with:

    <maximo-datasource-override id="locationHierarchyDS" lookup-data="true" offline-immediate-download="true" page-size="15" where="parent is not null"/>

    but that triggered an OSLC error.

    Goal is to have the Location drilldown on the SR form start at the second level: in my case, the root is MD and I want MA and MB (children of MD) to be the top-level nodes in the tree.

    2) Hiding "Contact person" and "Similar service requests" on the left side
    I'm now trying to simplify the Create SR split-view. On the left side I'd like to hide:

    • Contact person

    • Similar service requests

    From what I can see, the left-hand split view on Create SR is driven by sr-attributes-list.xml and the JSON entries like SRListContactDS etc. (same pattern discussed in the other SRMOBILE thread).

    3) Attachments before submitting the SR
    I'm also looking at making attachments "required" before the user submits the SR.

    On MAS 9.x I've found in the IBM docs that, starting in Maximo Mobile 9.0, users must save/submit the SR record before they can add attachments – adding attachments before the initial save isn't supported anymore to avoid local memory issues. IBM

    That matches what I'm seeing in SRMOBILE 9.1.6 – I can't add attachments until the record exists.

    Just to confirm with you: is the recommended pattern now to:

    • let users save the SR first,

    • then add attachments,

    • and enforce "at least one attachment" by putting a validation on the submit / status change (e.g. in appCustomization.js), rather than trying to require an attachment before the very first save?

    If you have a small 9.1-style code example for checking the attachments datasource during submit, that would be awesome.

    4) "Save my GPS in the Service Address" still not persisting
    Finally, I followed your earlier suggestion and wired a "Save my GPS" action that calls geolocation and tries to populate the service address. The button runs without error, device permissions are granted, and the user has create/update on SERVICEADDRESS.

    However, the coordinates still aren't being persisted with the SR.

    Thanks again for all your time and guidance,



    ------------------------------
    Mostafa Mosaad
    Software Engineer
    Megasoft
    Cairo
    01117275779
    ------------------------------



  • 7.  RE: How to reference an image (company logo) in SRMOBILE and start hierarchy from second level in Application Framework?

    Posted Fri November 14, 2025 06:36 AM

    I've attached a ss and the app.xml for reference 



    ------------------------------
    Mostafa Mosaad
    Software Engineer
    Megasoft
    Cairo
    01117275779
    ------------------------------

    Attachment(s)

    txt
    test2.txt   115 KB 1 version


  • 8.  RE: How to reference an image (company logo) in SRMOBILE and start hierarchy from second level in Application Framework?

    Posted 28 days ago

    Hi! 

    about parent is null in OSLC query is because that parent is not persistence field and has search = none. If you want to query it in OSCL, then use any relationship, for example

    LOCHIERLOCONLY.parent
    BUT! 
    Better option is filter on DB query in Integration Object Structure Query : query definitions 

     



    ------------------------------
    Andrey Ilinskiy
    Handz.on
    https://www.on.de/
    München
    ------------------------------



  • 9.  RE: How to reference an image (company logo) in SRMOBILE and start hierarchy from second level in Application Framework?

    Posted 28 days ago

    2) Hiding "Contact person" and "Similar service requests" on the left side

    You are on right way.

    How split-view-template works. It takes as dataSource sr-attributes.js and use it to build left side menu. It uses viewindex as position to show. So you need to remove from that JSON objects that you want to "hide" and be sure that viewindex is consistent (you dont have like 1, 2, 4, 5), otherwise scripts will crash because will not be able to find corrent index.

     



    ------------------------------
    Andrey Ilinskiy
    Handz.on
    https://www.on.de/
    München
    ------------------------------