Solution: Displaying the Question/Response within Questionnaire Sticky Note
The attached custom object code will display the Question and Question Response (if selected) within the Questionnaire Comments sub-form. This is an often asked for enhancement to prevent users from having to close the sticky note to re-read the question/response and re-enter the sticky note.
- Specifically, it will place the Question and Question Response at the top of the 2nd section in the sub-form layout (top of the General Information section assuming you have not change the out-of-box layout).
The code is agnostic of the instance number or URL, the user's session is leveraged. The only variable is the ID associated to the 'Source ID' field the Questionnaire Comments sub-form. To use this code, you should only have to create a custom object and copy/paste the code and ensure the custom object is someone on the layout.
- If the custom object does not display the Question and Question Response, you may need to adjust the Source Field ID on line 39.
Credit to Jason Solar for the development.
* I take no responsibility for use of this code.
- Community Thread
- Forum Thread
- RSA Archer
- RSA Archer Suite
- sticky note
- Tips and Tricks
Attached is a document of the issue I am seeing. I can get the question to appear in the comment only when the Source field is on the layout. However, even after saving the comment, saving the record, logging out, logging in, refreshing the page; the answer never displays. Records which already had a comment created for a question prior to the creation of the custom object, they display just fine. Anything new simply doesn't work.
Anything you are anybody else can share about their experiences with this code?
BTW, this is really cool and I like it a lot. It makes sense to display the information like this in the comment.
Thanks for trying this and giving some feedback. Not sure why the answer is not displaying if it was saved in the record.
It's displaying the question text, so that's good.
This will log some information in the browsers console window.
Could you try:
1. changing the line of code I mention above in your custom object
2. open your sticky note in the questionnaire
3. open the debug window in your browser (F12) and take a screen shot of the output?
I'm particularly interested in looking for a line that shows:
If there is not a number after questionanswerValuesListID:, then, for some reason it's not finding the associated values list value id for your question.
Jennifer, Sorry you're having issues with the code. What you posted is not the console.
However, in the subform, if you did not put the field called Source onto your layout, I know you'll see undefined.
The problem arises because of how Archer handles URLs.
So, when the URL does NOT contain the Tracking ID of the actual questionnaire, this breaks the ability to get the answer text (as the code is written).
I suspect what you're doing is creating a questionnaire from the engagement or target record.
Then, you move on to save the questionnaire, etc. If you notice in your URL the very last set of numbers will be your Tracking ID of the engagement or whatever target ID your using. ... Which is the problem.
If you close the record, go directly to a search on the questionnaire application and then open your questionnaire, the URL should contain the tracking ID of your questionnaire. And, then that code will do its thing and get the answer text.
it' still gets the question text either way, but not the answer.
Unfortunately, the code doesn't handle opening the questionnaire as you're doing to get the answer.
The sub-form won't have a reference of the questionnaire tracking ID.
1 way to solve (that I'm not in favor of) would be to create a custom object in your questionnaire that stores the ID when the sticky note button is clicked. Then, your sub-form could pull it from there.
if you look in the code, the issue is with this line --
QuestionnaireTrackingID = document.referrer.substring(document.referrer.indexOf('?')+4,document.referrer.indexOf('&'));
As you can see, we pull the ID from the URL. If you figure out a better way, please share!
Just want to double-check that you have the source field on your layout. I've tested and if it isn't, I'll get the same message.
If it's on layout, then... Do any of the questions work?
If you update the sub-form, this should work for all your questionnaires that use the sub-form.
Have you checked more than 1 questionnaire/question?
My next thought is that maybe you don't have advanced field display for the question(s).
Also, the screenshot you included in the chain was of the source code.
If you look at the snapshot again, there's a tab right next to it called "console". That's the screenshot we want to see.
It should be logging something there and we can start to identify the source of the failure.
If the above suggestions don't help, then make sure the script has
var debugging = true;
Then, attach a copy of the console window... I'd be looking for messages like:
and so on.