Skip to main content

This content has been archived and is no longer being updated. Links may not function; however, this content may be relevant to outdated versions of the product.

Support Article

Pega Social: unable to tag a link to work item

SA-11090

Summary



Error encountered while adding a link to Work Object (WO) through Pega Pulse

Error Messages



IE error description :Invalid argument

Steps to Reproduce



1. Add Pega-Social:06-03 ruleset to the application. 
2. Create a WO.
3. Add a link and enable the checkbox called “Attach to WO..”.
4. Click share button to observe the error. 


Root Cause



The root cause of this problem is a defect in Pegasystems’ code/rules.

This issue is primarily a transaction ID mismatch issue. 
There are a couple of reload sections sequentially executed on clicking the Share button. The first reload brings up a new transaction ID through the change tracker but the same is not updated for the second request leading to the transaction ID mismatch issue. 
The error was found in the logic in fixBaseThreadTxnId in pega_ui_doc.js specifically for those systems that have CSRFToken enabled in their prconfig. 
fixBaseThreadTxnId updates the pzTrasactionId with pxClientExchange obtained from the change tracker. This updating is skipped if baseThreadName and threadName in URL are different. The threadName is extracted as the text between first occurrence of “!” and first occurrence of “?” in the URL. 
So in the case of CSRF enabled, the tread name extracted would be !@f9088df81628673da41615c652fdb8b0!TABTHREAD0 which is different from the baseThreadName TABTHREAD0. because of which updation of the transaction ID is skipped.


Resolution



Add the below code in the userworkform to resolve the issue.

<script>
pega.ui.Doc.prototype.fixBaseThreadTxnId = function(baseURL) {

        if(baseURL && !(baseURL instanceof SafeURL)) {
            return;
        }
        if(typeof bRecordEvent != "undefined") {
            var origbRecordEvent = bRecordEvent;
            bRecordEvent = false;
        }
        var url = baseURL && baseURL.toURL ? baseURL.toURL() : null;
        if(typeof bRecordEvent != "undefined") {
            bRecordEvent = origbRecordEvent;
        }

        if(url) {
            var csrfToken = url.indexOf("/!@");
            if (csrfToken > -1) {
                var threadNamewithCSRFToken = url.substring(csrfToken + 3);
                var bangIndx = threadNamewithCSRFToken.indexOf("!")
                var endIndex = threadNamewithCSRFToken.indexOf('?');
                var threadName = threadNamewithCSRFToken.substring(bangIndx + 1, endIndex);
            } else {
                var startIndex = url.indexOf('!') + 1;
                var endIndex = url.indexOf('?');
                var threadName = url.substring(startIndex, endIndex);
            }
            if(pega.u.d.baseThreadName !== threadName) {
                return;
            }
        }

        var trackedTxnId = pega.ui.ChangeTrackerMap.getTracker().getPropertyValue("pxThread.pxClientExchange");
        if(trackedTxnId) {
                if(url && baseURL instanceof SafeURL) {
                    var oldTxnId = baseURL.get("pzTransactionId");
                    if(oldTxnId !== trackedTxnId) {
                        baseURL.put("pzTransactionId",trackedTxnId);
                    }
                }
                else {
                    pega.u.d.setFormActionTxnId(trackedTxnId);
                }
        }

    };

</script>

Published June 25, 2015 - Updated December 2, 2021

Was this useful?

0% found this useful

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega Community has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice
Contact us