3B Portals & Mobile App version 1.23 changelog

From 3B Knowledge
Revision as of 08:32, 8 October 2024 by Admin (talk | contribs) (Created page with "== Changes == We are making some changes in the communication protocols that run the Portals & Mobile apps application. Until this update, it could be hard to develop custom apex code for 3B Portals applications. We are now introducing a change that removes the need to use the b3p.GlobalRemotingRouter class. This change is necessary as we have multiple namespaces (b3p, b3s, b3v, b3d, & b3f), so in order to make things easier, now namespaces don't matter when making a cus...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Changes

We are making some changes in the communication protocols that run the Portals & Mobile apps application. Until this update, it could be hard to develop custom apex code for 3B Portals applications. We are now introducing a change that removes the need to use the b3p.GlobalRemotingRouter class. This change is necessary as we have multiple namespaces (b3p, b3s, b3v, b3d, & b3f), so in order to make things easier, now namespaces don't matter when making a custom apex class callout.

The new Portal Communication Architecture

Classes that need to be called from the portal custom components no longer need to use the b3p.GlobalRemotingInterface interface, instead they should rely solely on the system class "System.Callable"

//Old Format
public with sharing class CustomClass implements b3p.GlobalRemotingInterface{
    ...
}
//New Format
public with sharing class CustomClass implements System.Callable {
    ...
}

Then, simply implement a call method like so:

public static Object call(String action, Map<String, Object> args) {
        switch on action {
            when 'someAction' {
                return upsertRecords(
                    (String) args.get('param1'), 
                    (String) args.get('param2'));
            }
            when else {
                return new ErrorResponse(
                    String.format(
                        'Invalid Paraeter for class {0} and action {1}',
                        new List<Object>{ 'This class', action }
                    )
                );
            }
        }
    }