Monday, May 20, 2024

Fix to add mapping to Lighting Viz component in Lightning communities

 Adding the following markup in the "Edit Markup" section in community builder will fix the issue of mapping and generating the JWT (JSON Web Token) with the Lightning viz component to the Tableau server. This issue apparently is only related to Lightning viz component when used in the lightning communities.



<!-- START - TEMP FIX FOR MISSING MAPPING -->
<script>
    var prefix = "/services/data/v60.0";
    var prev = Object.defineProperty;
    var tempMapping = {
        // POST method for generating the custom Tableau embedding JWT
        'TableauEmbeddingController.postJWT': {
            urlPath: prefix + '/tableau/jwt',
            urlPathParamNames: [],
            method: 'POST',
            inputRepresentation: 'tableauJwtArgs'
        },
        // GET method to retrieve the custom Tableau embedding JWT
        'TableauEmbeddingController.getJWT': {
            urlPath: prefix + '/tableau/jwt',
            urlPathParamNames: [],
            method: 'GET',
        },
        // Get the Tableau EAS trust details
        'TableauEmbeddingController.getEAS': {
            urlPath: prefix + '/tableau/eas',
            urlPathParamNames: [],
            method: 'GET',
        }
    };
    Object.defineProperty = (obj, prop, descriptor) => {
        if (obj.getResourceReferenceFromAuraMethod) {
            var oldGetResourceReferenceFromAuraMethod = obj.getResourceReferenceFromAuraMethod;
            obj.getResourceReferenceFromAuraMethod = (name) => {
              return tempMapping[name] || oldGetResourceReferenceFromAuraMethod(name);
            };
        }
        prev(obj, prop, descriptor);
    }
</script>
<!-- END - TEMP FIX FOR MISSING MAPPING -->


No comments:

Post a Comment