Js validation on meeting module create view in sugarcrm Mobile app

Hi All,

I have one use case, as a sugarcrm user if I am creating meeting for converted lead then system should display error popup message "meeting cannot be created for converted prospect." on meeting create view in sugarcrm Mobile app.

Can anyone suggest how to add above js validation on meeting module create view in sugarcrm Mobile app

Please suggest asap.

Kindest Regards,

Shreya

Parents
  • Hi  ,

    Without going through Sugar's SDK development, you could achieve this by throwing an Exception in a LogicHook to control the creation of record in mobile. You can filter the platform value from the session variables so it will only execute the logic in the mobile app:

    $_SESSION['platform'] == 'mobile'

    https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.1/Integration/Web_Services/REST_API/API_Exceptions/index.html

    The downside is that, it won't show the custom error message that you specify in the hook and it will just throw a generic Sugar error message in the App unless the bug has been resolved in the recent versions.

    I hope that helps.

    Thank you.

    Regards,

    Kaizer

  • Hi Kaizer,

    Thanks for responding, I was also trying same way with below exception::

    "throw new SugarApiExceptionInvalidParameter('error message here');" in logic hook and on browser it show as error message same how sugar shows errors on UI but in mobile view it shows error in Chrome's developer tools -> Network tab and on mobile UI it show generic message to user "Internal error 422, please try again later", is there any way to display error on mobile UI?

    Please suggest?

    Kindest Regards,

    Shreya 

  • Hi  ,

    I think there is no option to display your own error message until this improvement or defect is fixed for upcoming editions.

    When the generic error is issued in the mobile, perhaps you might edit the label of that field to show the description of the issue as a workaround. You may include a brief explanation of the problem given that it can display the custom error code. The "name" field's label, for instance, may be changed to "Name (Exception 422: Meeting cannot be created for converted prospect)".

    You are allowed to modify the label you can use in the mobile views because, as you are aware, the views for the web and mobile platforms are independent.

    Regards,

    Kaizer

  • Hi Kaizer,

    I am using before save hook so can please tell me how we can change field label in before save hook?

    Also, how to show meeting sub panel conditionally in leads record view in mobile app?

    Please suggest.

    Kindest Regards,

    Shreya

  • Hi  ,

    You can create a file in language directory of your custom module:

    ./custom/Extension/modules/Meetings/Ext/Language/en_us.customMobileLabels.php

    // Mobile error labels
    $mod_strings['LBL_NAME_MOBILE_LABEL'] = 'XXX';

    Then manually set the label for the name field in the mobile's edit view file: custom/modules/Meetings/clients/mobile/views/edit/edit.php

    4 => 
            array (
              'name' => 'LBL_NAME_MOBILE_LABEL',
              'label' => '',
            ),

    Regards,

    Kaizer

  • Hi Kaizer,

    I think you didn't understand my query, I mean to throw error in mobile app from before save hook I am using "SugarApiExceptionInvalidParameter" on meeting module.

    So as per you suggestion in last reply how to "When the generic error is issued in the mobile, perhaps you might edit the label of that field to show the description of the issue as a workaround. You may include a brief explanation of the problem given that it can display the custom error code. The "name" field's label, for instance, may be changed to "Name (Exception 422: Meeting cannot be created for converted prospect)"."??

    Also, when lead is converted then how to hide meeting create button in meeting sub panel mobile app view in Lead Related module view in mobile?

    Please suggest.

    Kindest Regards,

    Shreya

  • Hi  ,

    As I previously stated, a flaw in the mobile platform prevents the custom error message you deliver on your before_save logic hook from being displayed. Instead, it will always throw a generic error. However, that halts the process of the creation of the meeting record. It's just a matter of how we can let the users know of the error being thrown in the mobile.

    To now, there is no way to manage buttons on a mobile device. Since you can filter the parent id and obtain the Lead's bean data in a before_save, you could always issue an exception and stop the creation of the meeting. Even if the create buttons are enabled you can still control the save part.

    Regards,

    Kaizer

  • You can edit a field's value but not its label directly in a before save hook. Labels are usually specified on the user interface layer and do not change at the database level. To modify how a field appears in the UI, you'll need to customize your application's view templates or UI configuration separately from the before save hook.

         // Show the meeting sub-panel if the lead status is "Qualified." if (leadStatus === "Qualified") {     // Code to display the meeting sub-panel     showMeetingSubPanel(); } else {     // Code to hide the meeting sub-panel     hideMeetingSubPanel(); }

Reply
  • You can edit a field's value but not its label directly in a before save hook. Labels are usually specified on the user interface layer and do not change at the database level. To modify how a field appears in the UI, you'll need to customize your application's view templates or UI configuration separately from the before save hook.

         // Show the meeting sub-panel if the lead status is "Qualified." if (leadStatus === "Qualified") {     // Code to display the meeting sub-panel     showMeetingSubPanel(); } else {     // Code to hide the meeting sub-panel     hideMeetingSubPanel(); }

Children
No Data