2012-08-22 4 views
1

내가 알 프레스코 (버전 4)에 새로운 오전 나는 다음과 같은 서명 기능을 가지고 이메일 보내기 위해 (실제로 lib.js) webscript를 만들 싶습니다프레스코에서 이메일을 보내는 방법 4

function sendMail(to, subject, templatePath, templateArgs) 

이를 함수는 일부 조건이 충족 될 때 다른 웹 스크립트에서 호출됩니다. 나는이 같은 스크립트를 발견 :

var mail = actions.create("mail"); 
mail.parameters.to = "[email protected]"; 
mail.parameters.subject = "Test subject"; 
mail.parameters.template = companyhome.childByNamePath("Data Dictionary/Email Templates/Workflow Notification/wf-email.html.ftl"); 

var templateArgs = new Array(); 
templateArgs['workflowTitle'] = "workflowTitle"; 
templateArgs['workflowPooled'] = true; 
templateArgs['workflowDescription'] = "workflowDesc"; 
templateArgs['workflowId'] = "workflowId"; 

var templateModel = new Array(); 
templateModel['args'] = templateArgs; 
mail.parameters.template_model = templateModel; 

mail.execute(search.findNode("workspace://SpacesStore/9e15aaac-b30b-4266-984f-21fe273a6113")); 

하지만 난 세 가지를 알 수 없기 때문에, 내 코드에 넣어하는 방법을 모른다 :

  • 나는이 코드를 사용할 수를 내 시나리오, 즉 js lib을 가져 와서 다양한 이메일을 보내는 데 사용할 수 있습니까?

  • 내가 할 수있는 경우 작업 참조 (파일의 시작 부분에서 무엇을 가져올 수 있습니까?)는 어디에서 찾을 수 있습니까?

  • mail.execute 함수에 인수로 넣어야하는 것은 무엇입니까?

답변

2

mail.execute는 "반대"규칙입니다. 이것은 코드가 야외에서 노드에 대해 함수를 실행하도록 요청한다는 의미입니다. 따라서 문서를 업로드 할 때 전자 메일을 보내면 mail.execute는 새로 만든 노드를 사용하므로 새로 만든 파일에 대한 링크를 메일에 추가 할 수 있습니다.

당신은 어쨌든 간단하게 만들 수 있고 규칙을 만들 수 있습니다.이 규칙은 생성/업데이트 될 때 일부 콘텐츠를 트리거하고 위에 게시 한 것과 같이 자동으로 원하는 사용자에게 sendmailaction.js를 사용합니다.

function sendMail() 
{ 
    var mail = actions.create("mail"); 
    mail.parameters.to = bpm_groupAssignees.properties["cm:email"]; 
    mail.parameters.subject = "New File uplodaded with name " + document.name; 
    mail.parameters.from = initiator.properties["cm:email"]; 
    mail.parameters.text = "Kindly approve the document: " + document.name; 
    mail.execute(document); 
} 
sendMail(); 
:

그렇지 않으면 당신이 뭔가를 만들 수 있습니다

관련 문제