Function to fetch Url Components of the Custom Record

/**

         * To fetch Url Components of the Custom Record

         * @param {*} url

         * @returns

         */

        function extractRecordInfoFromUrl(url) {

            try {

                // Define regular expressions to match the parameters

                let rectypeRegex = /rectype=(d+)/;

                let idRegex = /id=(d+)/;

                let idAccntRegex = /compid=(d+)/;

                let matchRectype = url.match(rectypeRegex);

                let matchId = url.match(idRegex);

                let matchAccId = url.match(idAccntRegex);

                return {

                    recordType: matchRectype[1],

                    recordId: matchId[1],

                    accntId: matchAccId[1]

                };

            } catch (Err) {

                log.error(“Err@extractRecordInfoFromUrl”, Err)

            }

        }

Leave a comment

Your email address will not be published. Required fields are marked *