Skip to Content
0

How to manually generate "External URL link" for Satisfaction Survey

Jun 02, 2017 at 08:35 AM

204

avatar image

Hello Experts,

I'm currently trying to find out how to generate an "Exrernal URL link" for Satisfaction Survey(the one which users receive in E-mails e.g. during Campaign).

I managed to identify that Surveys are stored in Questionnaire business object and that there is "ValuationCollection" node which is used to track the survey completion.

I assume that the External link is being generated when ValuationCollection is being created however I didn't manage to create ValuationCollection from ABSL script for Satisfaction Survey.

Code example which is sadly not working:

var ID : common:BusinessTransactionDocumentID;
ID.content = "1";
var type : common:BusinessTransactionDocumentTypeCode;
type = "39";
Survey.AddValuationColl(ID,type);

Best Regards,

Dariusz

c4c | absl | pdi | survey
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Stefan Hagen
Jun 29, 2017 at 09:27 AM
1

Hi Dariusz,

I wrote this Code a couple of years ago. Does this help? The Survey does not Support any object as reference. I think it must be either a Visit or an Appointment. I remember that we have created shadow Appointments just for the sake of creating Surveys back then and then used the existing Questionnaire Modal Dialog (MD) to display the survey. Link Generation is done by this MD via ABAP includes, which is not accessible from the SDK. The link itself is not stored in the data model but built on the fly (otherwise a tenant copy would break the links).

// declare variables with matching types
var visit_id :  BusinessTransactionDocumentID;
var visit_proccode :BusinessTransactionDocumentTypeCode;

// set visit ID and typecode for the hosting object
visit_id.content = visit.ID;
visit_proccode = "12";

// select the questionnnaire based on which a new survey should be created
var query = Questionnaire.QueryByElements;
var sel = query.CreateSelectionParams();
sel.Add(query.QuestionnaireID, "I","EQ", this.SurveyID.content);
var result = query.Execute(sel);

// if this quesionaire is present, continue
if(result.Count() == 1) {
 survey = result.GetFirst();
 
 // add a new valuation collection based on the hosting object (id + typecode)
 survey.AddValuationColl( visit_id, visit_proccode );
 
 // look for created valuation collection based on the hosting object UUID
 var vallColls = survey.ValuationCollection.Where( n => n.BusinessTransactionDocumentUUID.content == visit.UUID );
 var vallColl = vallColls.GetFirst( ); // must be present at this point
 
 // open the survey for processing
 if ( vallColl.IsSet() ) {
  vallColl.SetAsOpen( );
 }
}
Share
10 |10000 characters needed characters left characters exceeded