DocuSign for Salesforce.com - salesforce

I have 2 users. I need to send the envelope to User 1 to sign. Once user 1 has signed the document, User 2 needs to get the envelope to sign the document.
I have written a Custom button on a Custom object where I am passing the envelop ID and Passing the users to whom the envelope will be sent along with the routingOrder, but the envelope is received by both the users. I was not able to find a proper document that could help me resolve the issue. Piece of javascript:
{!REQUIRESCRIPT("/apex/dsfs__DocuSign_JavaScript")}
//********* Option Declarations (Do not modify )*********//
var RC = '';var RSL='';var RSRO='';var RROS='';var CCRM='';var CCTM='';var CCNM='';var CRCL=''; var CRL='';var OCO='';var DST='';var LA='';var CEM='';var CES='';var STB='';var SSB='';var SES='';var SEM='';var SRS='';var SCS ='';var RES='';
//*************************************************//
//DocuSign Template
var DST='';
//Adding Notes & Attachments
var LA='1';
//Custom Recipient List
var CRL='Email~test_1#gmail.com;FirstName~user;LastName~1;Role~Signer 1;RoutingOrder~1,Email~test_2#gmail.com;LastName~user2;Role~Signer 2;RoutingOrder~2,LoadDefaultContacts~1';
//Custom Contact Role Map
var CCRM='Signer 1~Signer 1;Signer 2~Signer 2';
//Custom Contact Type Map
var CCTM='Signer 1~Signer 1;Signer 2~Signer 2';
//Custom Email Subject
var CES='{!CustomObject__c.Id} - Please eSign Vocus Sales Agreement';
//Custom Email Message
var CEM='I am sending you this request for your electronic signature, please review and electronically sign by following the link below.';
//Custom Envelop from Docusign
var DST = '00000000-33F0-4A8C-A8B2-00000000000';
//********* Page Callout (Do not modify) *********//
window.location.href ="/apex/dsfs__DocuSign_CreateEnvelope?DSEID=0&SourceID={!CustomObject__c.Id}&RC="+RC+"&RSL="+RSL+"&RSRO="+RSRO+"&RROS="+RROS+"&CCRM="+CCRM+"&CCTM="+CCTM+"&CRCL="+CRCL+"&CRL="+CRL+"&OCO="+OCO+"&DST="+DST+"&CCNM="+CCNM+"&LA="+LA+"&CEM="+CEM+"&CES="+CES+"&SRS="+SRS+"&STB="+STB+"&SSB="+SSB+"&SES="+SES+"&SEM="+SEM+"&SRS="+SRS+"&SCS="+SCS+"&RES="+RES;
//*******************************************//
Please do let me know what I am missing out.
Thanks in advance for helping out.

Most likely an issue with how you're setting CCRM and CCTM. Try changing to this instead (replace ALL_CAPS_TEXT with appropriate Role Names from the DocuSign Template you're using):
//Custom Contact Role Map
var CCRM='Signer 1~ROLE_NAME_OF_FIRST_RECIPIENT_IN_DOCUSIGN_TEMPLATE;Signer 2~ROLE_NAME_OF_SECOND_RECIPIENT_IN_DOCUSIGN_TEMPLATE';
//Custom Contact Type Map
var CCTM='Signer 1~Signer;Signer 2~Signer';
Notice that in setting the value of CCTM, the second value in each entry should simply be "Signer" (as shown above).
Also, since you're using a DocuSign Template (DST), you should verify that the Recipient Routing Order is set appropriately there as well.
Here's a (working) example for a custom button that sends to the first recipient first, and then when that recipient completes the envelope, sends to the second recipient:
Recipient Role Names & Routing Order as Defined by the DocuSign Template that the custom button uses:
Custom button code:
{!REQUIRESCRIPT("/apex/dsfs__DocuSign_JavaScript")}
//********* Option Declarations (Do not modify )*********//
var RC = '';var RSL='';var RSRO='';var RROS='';var CCRM='';var CCTM='';var CCNM='';var CRCL=''; var CRL='';var OCO='';var DST='';var LA='';var CEM='';var CES='';var STB='';var SSB='';var SES='';var SEM='';var SRS='';var SCS ='';var RES='';
//*************************************************//
//DocuSign Template
var DST='';
//Adding Notes & Attachments
var LA='1';
//Custom Recipient List
var CRL='Email~johnsemail#outlook.com;FirstName~user;LastName~1;Role~Signer 1;RoutingOrder~1,Email~janesemail#outlook.com;LastName~user2;Role~Signer 2;RoutingOrder~2,LoadDefaultContacts~1';
//Custom Contact Role Map
var CCRM='Signer 1~Customer;Signer 2~SalesRep';
//Custom Contact Type Map
var CCTM='Signer 1~Signer;Signer 2~Signer';
//Custom Email Subject
var CES='Please eSign Vocus Sales Agreement';
//Custom Email Message
var CEM='I am sending you this request for your electronic signature, please review and electronically sign by following the link below.';
//Custom Envelop from Docusign
var DST = '7C350ABB-74F9-463E-96E3-49153AA25607';
//********* Page Callout (Do not modify) *********//
window.location.href ="/apex/dsfs__DocuSign_CreateEnvelope?DSEID=0&SourceID={!Opportunity.Id}&RC="+RC+"&RSL="+RSL+"&RSRO="+RSRO+"&RROS="+RROS+"&CCRM="+CCRM+"&CCTM="+CCTM+"&CRCL="+CRCL+"&CRL="+CRL+"&OCO="+OCO+"&DST="+DST+"&CCNM="+CCNM+"&LA="+LA+"&CEM="+CEM+"&CES="+CES+"&SRS="+SRS+"&STB="+STB+"&SSB="+SSB+"&SES="+SES+"&SEM="+SEM+"&SRS="+SRS+"&SCS="+SCS+"&RES="+RES;
//*******************************************//
This is the exact same button code that you provided in your question -- with only minor changes:
Changed email addresses in CRL (so I could test receiving the emails).
Changed CCRM to specify corrsponding Recipient Role Name from DocuSign Template for each signer.
Changed CCTM to use just "Signer" as the second portion for each item.
Changed DST to the ID of a Template in my DocuSign account (so I could test).
Updated window.location.href to use Opportunity.Id as SourceID (so I could test).

Related

How to add an organizer to Online meeting created using Microsoft Graph API

I have an admin account to create Online meetings of Graph API. Suppose I want to create online meetings for others to be the organizer, how should I do it? I do not see any parameter for that while creating the meeting.
You can request /me/onlineMeetings/createOrGetAPI, and then add the organizer to the request body.
please see: here
Try this:
var client = new RestClient("https://graph.microsoft.com/v1.0/me/onlineMeetings");
var request = new RestRequest(Method.POST);
request.AddHeader("cache-control", "no-cache");
request.AddHeader("content-type", "application/json");
request.AddHeader("authorization", "Bearer "+token);
request.AddHeader("accept-language", "en");
request.AddHeader("accept", "application/json");
request.AddParameter("application/json", "{\"startDateTime\": \"2020-09-
28T19:30:34.2444915-07:00\",\n\"endDateTime\": \"2020-09-
28T20:00:34.2464912-07:00\",\"subject\": \"User Token Meeting\"}",
ParameterType.RequestBody);
var response = client.Execute(request);
To retrieve the token:
var client = new RestClient("https://login.microsoftonline.com/{tenant-
Id}/oauth2/v2.0/token");
var request = new RestRequest(Method.POST);
request.AddHeader("cache-control", "no-cache");
request.AddHeader("content-type", "application/x-www-form-urlencoded");
request.AddHeader("grant_type", "password");
request.AddParameter("application/x-www-form-urlencoded",
"grant_type=password&client_id={client-Id}&client_secret={client-
secret}&scope={scopeurl}&userName={username}&password={password}",
ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
var json = response`.`Content;
var JSONObject = JObject.Parse(json);
var token = (string)JSONObject["access_token"];

How do you create a new user with Membership in MVC 5

I have created a small demo in angularjs with mvc c# and I want to have a login facility using membership provider. I have tried this simple code for the getting records from the database but it doesn't return any users from the database. There are users in the database.
The membership setting in web.config file:
<membership defaultProvider="AspNetSqlMembershipProvider">
<providers>
<clear />
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="DefaultConnection" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="true" maxInvalidPasswordAttempts="50" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" />
</providers>
</membership>
then I call this method to get all users:
Membership.GetAllUsers()
Does anyone know what the problem might be? Thanks.
If you have an Azure subscription, then I would recommend using Azure AD B2C. This allows you to create an Azure AD instance specifically for your app(s). They support Azure AD accounts and you can configure additional identity providers like Google, Facebook, MS Personal Account (outlook.com), Linkedin, etc.
It allows you to define custom profile properties in the portal and enabled you to configure the layout / experience for 'New User SignUp', 'Edit My Profile', 'Password Reset', and others.
If you're using Azure AD B2C and ASP.NET Identity in your application, you do not need to sign-up a user yourself. However, if you want access to a new user's data or claims after sign-up, you should be able to access it by modifying the AccountController.cs
In my AccountController.cs:
public void SignUpSignIn(string redirectUrl = "")
{
// this redirect url is where the user is routed after authentication.
var default_redirectUrl = "/account/gateway";
if (string.IsNullOrWhiteSpace(redirectUrl))
{
redirectUrl = default_redirectUrl;
}
// Use the default policy to process the sign up / sign in flow
HttpContext.GetOwinContext().Authentication.Challenge(new AuthenticationProperties { RedirectUri = redirectUrl });
return;
}
// this is where the user is redirected after sign-up
public async Task<ActionResult> Gateway()
{
// if you cast the User.Identity as
// System.Security.Claims.ClaimsIdentity then you can access
// the claims from the identity provider.
var userClaims = (User.Identity as ClaimsIdentity).Claims;
var issuer_claim = userClaims.FindClaim("iss")?.Value;
var nameid_claim = userClaims.FindClaim("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier")?.Value;
var audience_claim = userClaims.FindClaim("aud")?.Value;
var auth_time_claim = userClaims.FindClaim("auth_time")?.Value;
var idprovider_claim = userClaims.FindClaim("http://schemas.microsoft.com/identity/claims/identityprovider")?.Value;
var displayname_claim = userClaims.FindClaim("name")?.Value;
var objectid_claim = userClaims.FindClaim("http://schemas.microsoft.com/identity/claims/objectidentifier")?.Value;
var country_claim = userClaims.FindClaim("country")?.Value;
var newUser_claim = userClaims.FindClaim("newUser")?.Value;
var emails_claim = userClaims.FindClaim("emails")?.Value;
// Then you can use this claims as needed.
// after this navigate to your homepage or whatever makes sense.
return RedirectToAction("Index", "Home");
}
I hope this helps.
Link / More Info: https://azure.microsoft.com/en-us/services/active-directory/external-identities/b2c/

Integrating cordova plugin paypal with ionic

I'm trying to use the paypal-cordova-plugin to integrate paiement on my mobile app. But the instructions I am following are asking for sandbox id and production id but I have no idea where to find them in paypal. Can someone help me on this ?
This is the place where they are asked
angular.module('app')
.constant("shopSettings", (function () {
return {
payPalSandboxId: "Aar8HZzvc5NztVWodTBpOiOod9wWrBDrJUjyvRr4WsxcCD28xYig7oecfYsqxQUDu5QHptPpSALirxZD",
payPalProductionId : "production id here",
payPalEnv: "PayPalEnvironmentSandbo", // for testing production for production
payPalShopName : "SenPass",
payPalMerchantPrivacyPolicyURL : "url to policy",
payPalMerchantUserAgreementURL : "url to user agreement"
}
})());
This is the link I'm following : http://ionicandroidlearning.blogspot.fr/2015/11/ionic-paypal-integration.html
First you need to create an account on paypal developers.
Then inside the dashboard create a new application (REST API apps).
When you create the new app, Paypal will generate a sandbox account and a client id for you.
Add the code (example):
var configuration=function () {
var configOptions = {
merchantName: "Some name you have specified",
merchantPrivacyPolicyURL: "http://yourserver/privacypolicy",
merchantUserAgreementURL: "http://yourserver/agreement",
languageOrLocale: "en_US"
};
// for more options see paypal-mobile-js-helper.js
var _config = new PayPalConfiguration( configOptions );
return _config;
}
var onPrepareRender = function(){
$log.info(" ======= onPrepareRender ==========");
}
var onPayPalMobileInit = function(){
var payPalConfig = configuration();
PayPalMobile.prepareToRender("PayPalEnvironmentSandbox", payPalConfig, onPrepareRender);
deferred.resolve( payPalConfig );
}
var clientIDs = {
"PayPalEnvironmentProduction": '', //leave it blank
"PayPalEnvironmentSandbox": 'your sandbox id'
};
PayPalMobile.init(clientIDs, onPayPalMobileInit);
to retrive PayPal Sandobx keys try to go here:
https://developer.paypal.com/developer/accounts/
click on your generated account for testing (in the table) and then on Profile ...it open a modal with some tabs .. choose the API Credential tab
Hope it can help you

Salesforce - Custom Button - "Apex CPU Time Limit"

Yesterday I updated the DocuSign Template ID on a previously successful custom button and began receiving the error message below. So I changed the Template ID back to the original value and continue to receive the same error.
Thoughts on what might be going on?
Error Message:
"Apex CPU time limit exceeded Error is in expression '{!CreateEnvelopeRecord}' in component in page dsfs:docusign_createenvelope: (dsfs)"
Button Code:
{!REQUIRESCRIPT("/apex/dsfs__DocuSign_JavaScript")}
//********* Option Declarations (Do not modify )*********//
var RC = '';var RSL='';var RSRO='';var RROS='';var CCRM='';var CCTM='';var CCNM='';var CRCL=''; var CRL='';var OCO='';var DST='';var LA='';var CEM='';var CES='';var STB='';var SSB='';var SES='';var SEM='';var SRS='';var SCS ='';var RES='';
//*************************************************//
// Modify individual options here:
// DocuSign Template ID (default no template)
DST = '5FA61634-AA13-4BCB-B02A-521B19C3DFB4'; //Ex: '67870A79-A0B5-4596-8AC1-CC7CC1EA01EB'
// Load Attachments (default on)
LA = ''; //Ex: '0'
// Custom Email Message (default in config)
CEM = 'Thank you for doing business with XOJet, here is the agreement for your signature.' ; //Ex: 'Envelope sent by [FirstName] [LastName] ([Email])!'
// Custom Email Subject (default in config)
CES = 'XOJet agreement for signature'; //Ex: 'Re: Opportunity Name: {!Opportunity.Name}'
// Show Tag Button (default in config)
STB = ''; //Ex: '1'
// Show Send Button (default in config)
SSB = ''; //Ex: '1'
// Show Email Message (default in config)
SEM = ''; //Ex: '1'
// Show Reminder/Expire (default in config)
SRS = ''; //Ex: '1'
// Show Chatter (default in config)
SCS = ''; //Ex: '1'
// Reminder and Expiration Settings
RES = ''; //Ex: '0,1,2,0,120,3'
//********* Page Callout (Do not modify) *********//
window.location.href = "/apex/dsfs__DocuSign_CreateEnvelope?DSEID=0&SourceID={!Opportunity.Id}&RC="+RC+"&RSL="+RSL+"&RSRO="+RSRO+"&RROS="+RROS+"&CCRM="+CCRM+"&CCTM="+CCTM+"&CRCL="+CRCL+"&CRL="+CRL+"&OCO="+OCO+"&DST="+DST+"&CCNM="+CCNM+"&LA="+LA+"&CEM="+CEM+"&CES="+CES+"&SRS="+SRS+"&STB="+STB+"&SSB="+SSB+"&SES="+SES+"&SEM="+SEM+"&SRS="+SRS+"&SCS="+SCS+"&RES="+RES;
//*******************************************//
Is this a managed package, or your own page? The page is taking too long to run and exceeds the governor limit (from Salesforce). If it is your own page then check your code (specifically look for loops to eliminate).
If it is managed you will probably need to file a ticket.
Salesforce limits doc:
https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_gov_limits.htm
I'm still not sure what's going on, but I may have a new clue. I found the code below in another discussion at DocuSign for Salesforce.com
What's curious is that if I use the code below I will no longer get the "Time Limit" error. HOWEVER, it breaks when I replace the Custom Envelop ID to the one I"m using. Same "Time Limit" error.
I downloaded the XML again or the template to double-check the ID and it's correct. I know virtually zip about code and an API's so I'm baffled.
Thoughts?
{!REQUIRESCRIPT("/apex/dsfs__DocuSign_JavaScript")}
//********* Option Declarations (Do not modify )*********//
var RC = '';var RSL='';var RSRO='';var RROS='';var CCRM='';var CCTM='';var CCNM='';var CRCL=''; var CRL='';var OCO='';var DST='';var LA='';var CEM='';var CES='';var STB='';var SSB='';var SES='';var SEM='';var SRS='';var SCS ='';var RES='';
//*************************************************//
//DocuSign Template
var DST='';
//Adding Notes & Attachments
var LA='1';
//Custom Recipient List
var CRL='Email~johnsemail#outlook.com;FirstName~user;LastName~1;Role~Signer 1;RoutingOrder~1,Email~janesemail#outlook.com;LastName~user2;Role~Signer 2;RoutingOrder~2,LoadDefaultContacts~1';
//Custom Contact Role Map
var CCRM='Signer 1~Customer;Signer 2~SalesRep';
//Custom Contact Type Map
var CCTM='Signer 1~Signer;Signer 2~Signer';
//Custom Email Subject
var CES='Please eSign Vocus Sales Agreement';
//Custom Email Message
var CEM='I am sending you this request for your electronic signature, please review and electronically sign by following the link below.';
//Custom Envelop from Docusign
var DST = '7C350ABB-74F9-463E-96E3-49153AA25607';
//********* Page Callout (Do not modify) *********//
window.location.href ="/apex/dsfs__DocuSign_CreateEnvelope?DSEID=0&SourceID={!Opportunity.Id}&RC="+RC+"&RSL="+RSL+"&RSRO="+RSRO+"&RROS="+RROS+"&CCRM="+CCRM+"&CCTM="+CCTM+"&CRCL="+CRCL+"&CRL="+CRL+"&OCO="+OCO+"&DST="+DST+"&CCNM="+CCNM+"&LA="+LA+"&CEM="+CEM+"&CES="+CES+"&SRS="+SRS+"&STB="+STB+"&SSB="+SSB+"&SES="+SES+"&SEM="+SEM+"&SRS="+SRS+"&SCS="+SCS+"&RES="+RES;
//*******************************************//

emails from gmail but response is gmail.readonly

I am trying to get the emails from gmail using https://www.googleapis.com/auth/gmail.readonly/?access_token='fdrt654vfdgfe6545But in response I am getting gmail.readonlyBut the System.HttpResponse[Status=OK, StatusCode=200] is fine. Can any guide me is there anything I am missing out.
This I how I requested got auth but in the response I received access token
<script type="text/javascript">
(function() {
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/client:plusone.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();
</script>
<script type="text/javascript">
(function() {
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/client:plusone.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();
var AuthStates = {google: null};
function signinCallback(authResult) {
if (authResult['status']['signed_in']) {
// Update the app to reflect a signed in user
// Hide the sign-in button now that the user is authorized, for example:
document.getElementById('signinButton').setAttribute('style', 'display: none');
//alert(authResult['code']);
console.log('code state: ' + authResult['code']);
//console.log('authResult : ' + authResult[]);
AuthStates.google = authResult;
console.log('authResult 1 : ' + authResult['status']['method']);
console.log('auth Result : ' + authResult['id_token']);
//{!access_token} = authResult['access_token'];
//{!code} = authResult['code'];
connection(authResult['access_token'], authResult['code']);
} else {
// Update the app to reflect a signed out user
// Possible error values:
// "user_signed_out" - User is signed-out
// "access_denied" - User denied access to your app
// "immediate_failed" - Could not automatically log in the user
console.log('Sign-in state: ' + authResult['error']);
}
}
</script>
<apex:outputPanel >
<span id="signinButton">
<span
class="g-signin"
data-callback="signinCallback"
data-clientid="clientid"
data-cookiepolicy="single_host_origin"
data-scope="https://www.googleapis.com/auth/gmail.readonly"
data-response_type="code"
data-redirect_uri="http://test-on.ap1.visual.force.com/apex/Gmail_inbox">
</span>
</span>
<apex:form >
So as i got my access token from my request I can go directly for getting all information related to the logedin user. As I am getting all the information regarding the user I am trying to get all the emails related to him. Is I am doing right or I am wrong any place. I am very new with api and web service trying to learn. please do help me put out.
You're actually making an HTTP GET call to that URL ( https://www.googleapis.com/auth/gmail.readonly/?access_token= ...)? Isn't that just the auth scope identifier?
Once you have a valid Oauth2 token you can set in the Auth header then you can make HTTP requests to the API. For example, to list messages see:
https://developers.google.com/gmail/api/v1/reference/users/messages/list
That has the URL to access (GET https://www.googleapis.com/gmail/v1/users/me/messages ) then once you have the message IDs you can get the messages individually following: https://developers.google.com/gmail/api/v1/reference/users/messages/get (e.g. GET https://www.googleapis.com/gmail/v1/users/me/messages/ ).
Usually there are good client libraries for the Google APIs. Not sure if that works for you, but see, for example:
https://developers.google.com/gmail/api/downloads

Resources