Veeva CRM中的点击流跟踪

时间:2015-12-27 17:23:19

标签: javascript salesforce crm

我正在与Veeva CRM合作,尝试使用点击流跟踪。我有我正在使用的代码,并试图跟踪演示文稿ID,产品密钥消息,跟踪元素描述和答案。

任何人都可以帮助我使用的代码。 感谢

<!DOCTYPE html> 
<html lang="en"> 
  <head> 
   <meta charset="utf-8"> 
     <meta http-equiv="X-UA-Compatible" content="IE=edge"> 
   <meta name="viewport" content="width=device-width, initial-scale=1"> 
   <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> 
  <title>CLM_CERT_HCPName</title> 

  <!-- Bootstrap --> 
 <link href="css/style.css" rel="stylesheet"> 
 <link href="css/animate.css" rel="stylesheet"> 
 <script src="js/veeva-library-3.0.js"></script> 
  <script> 
    function start(){ 
     header_getAccountName(); 
    } 
  function header_getAccountName(){    com.veeva.clm.getDataForCurrentObject("Account","Name",header_displayAccountName)} 
 function header_displayAccountName(result){ 
var AccountNameHTML = document.getElementById("hcpName"); 
AccountNameHTML.innerHTML += result.Account.Name;com.veeva.clm.getDataForCurrentObject("Presentation","Survey_vod__c",header_getSurveyID); 
} 

function mySaveObject(){ 
//This is the start of my JSON object 
var myCallClickStream = {Call_vod__c, Key_Message_vod__c}; 

//i am using my JSON obj name with the field API name of the call clickstream     object obj.apiName then set the value. obj.apiName= value;] 
// Create the record using the com.veeva.clm.createRecord 
com.veeva.clm.createRecord("Call_ClickStream_vod_c", myCallClickStream, printSavedResults)}
function printSavedResults(result){ 
alert(JSON.stingify(result)); 
} 
</script> 
</head> 

                                       

<!-- jQuery (necessary for Bootstrap's JavaScript plugins) --> 
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> 

   

我还有一些示例代码可以尝试,但不确定我做错了什么。

function mySaveObject(){
var myCallClickStream = {};
myCallClickStream.Text_Entered_vod__c = "i will put some text here";

com.veeva.clm.createRecord("Call_Clickstream_vod__c", myCallClickStream, printSavedResults)
}

function printSavedResults(result) {
alert(JSON.stringify(result));
}

1 个答案:

答案 0 :(得分:1)

不确定您是否仍然需要帮助。但我的团队在每个项目中都使用一种简单的方法来简化跟踪过程。以下内容经过修改,符合您的一些命名惯例/需求。

// clmDescription - string submitted as the description to be tracked
// clmAnswer - string submitted as the answer to be tracked`
// callback - call back function which will be used to return the information

function mySaveObject( clmDescription, clmAnswer, clmCallback ) {
    var url = window.location.pathname,
        filename = url.substring(url.lastIndexOf('/') + 1),
        clmTrackingID = filename.replace(".html", "");

    var myCallClickStream = {};

    myCallClickStream.Track_Element_Id_vod__c = clmTrackingID;
    myCallClickStream.Track_Element_Type_vod__c = clmDescription;
    myCallClickStream.Selected_Items_vod__c = clmAnswer;
    myCallClickStream.Track_Element_Description_vod__c = clmAnswer;

    // var myJSONText = JSON.stringify( myCallClickStream );

    com.veeva.clm.createRecord( Call_Clickstream_vod__c, myCallClickStream, clmCallback );
}

只需调用方法并传入参数,包括回调方法。

希望这有帮助!