Pre-Filled/Sender's Tabs on a Template - c#

I have a sender's/pre-filled tab inside a template. I'm trying to send this template using C# api. Now I'm using the below code to fill this tab while sending a envelope using this template
`var env = new EnvelopeDefinition { TemplateId = templateId };
var prefillTabs = new PrefillTabs()
{
TextTabs = new List<Text>()
{
new Text()
{
DocumentId = "1",
TabLabel = "business-details.BusinessInformation.BusinessName",
Value = "PreFill: BusinessName"
}
}
};
var tabs = new Tabs()
{
PrefillTabs = prefillTabs
};
var signerRole = new TemplateRole
{
Email = signer.Email,
Name = signer.Email,
RoleName = templateRoleName,
Tabs = tabs
};
env.TemplateRoles = new List<TemplateRole> { signerRole };
env.Status = "sent";
// send this envelop using EnvelopApiClient
await envelopesApi.CreateEnvelopeAsync(accountId, env);`
Envelop is sent but the problem is prefilled tab is not populated and also SignHere field is not visible in the sent envelope. I have spent a lot of time figuring it out but couldn't figure it out. Any help will be much appreciated.

DocuSign pre-fill tabs are NOT associated with a recipient or a role. So the code you have cannot work because you have them assigned to the recipient (role) in your template.
What you need to do is either:
Create the fields/tabs you want in the template itself. They will be passed to any envelope created from the template. (Downside - every envelope created from this template will have them).
Add the prefill fields with code like this after the envelope is already created (Downside - need two API calls instead of one):
[![enter image description here][2]][2]
var apiClient = new ApiClient(basePath);
apiClient.Configuration.DefaultHeader.Add(
"Authorization", "Bearer " + accessToken);
EnvelopesApi envelopesApi = new EnvelopesApi(apiClient);
PrefillTabs prefillTabs = new PrefillTabs();
prefillTabs.TextTabs = new List<Text>();
prefillTabs.TextTabs.Add(
new Text { PageNumber = "1", DocumentId = "1", Value = "MyValue" });
Tabs tabs = new Tabs();
tabs.PrefillTabs = prefillTabs;
envelopesApi.CreateDocumentTabs(accountId, envelopeId, "1", tabs);

Related

STRIPE API - Create payment link to custom account got wrong

How do i create payment link to custom account via stripe.net library?
I have tried with these codes but its created product and payment link to my stripe connected account instead of custom account as i want.
// create payment link
var plinkOpt = new PaymentLinkCreateOptions
{
LineItems = new List<PaymentLinkLineItemOptions>
{
new PaymentLinkLineItemOptions
{
Price = new PriceService().Create(
new PriceCreateOptions
{
Currency = "usd",
Product = new ProductService().Create(new ProductCreateOptions { Name = "myproductname", }).Id,
CustomUnitAmount = new PriceCustomUnitAmountOptions { Enabled = true },
}).Id,
Quantity = 1,
},
},
};
var plinkSer = new PaymentLinkService();
plinkSer.Create(plinkOpt);
I hope to have codes to solve my problem or a solution to do it. Thank you
You need to set the StripeAccount in RequestOptions (API ref):
var options = new RequestOptions
{
StripeAccount = "acct_123"
};
plinkSer.Create(plinkOpt, options);
Edit: However, this should only be used with Standard accounts, not custom accounts.

Sentry - adding arbitrary key/value pairs to the user context

In the following documentation, it states that you can
...provide arbitrary key/value pairs beyond the reserved names and those will be stored with the user
In C# code, I have the following:
var _user = new {
Login = "fred",
EmailAddress = "fred#here.com",
Name = "Fred Flintstone"
}
SentrySdk.ConfigureScope( scope => {
scope.User = new Sentry.Protocol.User()
{
Id = _user.Login,
Email = _user.EmailAddress,
Username = _user.Login
};
});
Is there a way to add Name (or any other field)? Or is the documentation just referring to tags?
You can add your custom user data via the Other property.
The latest version of the Sentry.Protocol has Other as a IReadOnlyDictionary which means you need to assign a new instance like:
var sut = new User
{
Id = "user-id",
Email = "test#sentry.io",
IpAddress = "::1",
Username = "user-name",
Other = new Dictionary<string, string>
{
{"Name", "your name"},
{"anything else", "whatever"},
}
};
This PR is making Other mutable so you can add data like:
var user = new User();
user.Other.Add("key", "value");

How to fill a ACF repeater field by WordPressSharp in C#?

I can send data and fill simple custom fields. But it does not work with ACF repeater fields. It does not get value at all.
using (var client = new WordPressClient(new WordPressSiteConfig
{
BaseUrl = "http://example.com",
Username = "username",
Password = "pass",
BlogId = 1
}))
{
var customFields = new[]
{
new CustomField
{
Key = "field_586c1a9332541",
Value = "google.com";
}
};
var post = new Post
{
PostType = "video",
Title = "title",
Content = "description",
PublishDateTime = DateTime.Now,
Status = "draft",
CustomFields = customFields
};
var id = client.NewPost(post);
}
Is it possible to work with repeater fields by WordPressSharp ?!

How to set value in "AssignedTo" field in TFS programatically while creating a UserStory?

Code:
// To create a User Story
var collectionUri = new Uri(txtTFS.Text);
var tpc = new TfsTeamProjectCollection(collectionUri);
var workItemStore = tpc.GetService<WorkItemStore>();
var teamProject = workItemStore.Projects[txtSelectedProject.Text];
var typeWorkItem = ConfigurationManager.AppSettings["WorkItemType"];
var workItemType = teamProject.WorkItemTypes[typeWorkItem];
var userStory = new WorkItem(workItemType)
{
Title = "Test Title",
Description = "Test Description",
IterationPath = "xx\\yy\\zz",
AreaPath = "xxx\\yyy\\zzz",
State = "New",
// "AssignedTo" field not populated here...
};
// Save the new user story.
userStory.Save();
How to set value in "AssignedTo" field in TFS programatically while creating a UserStory?
Only the fields that are on every work item type have their own property on the WorkItem class.
You should use the WorkItem.Fields property to access any field that are not properties.
userStory.Fields["System.AssignedTo"].Value = "JJJ";
You cannot really use properties with indexers inside object intialiser syntax so you will have to have then on a new line before .Save();

How to add post thumbnail using joeblogs or xml-rpc?

How do I add thumbnail image content using joeblogs or xmlrpc?
add content code:
var post = new Post();
post.DateCreated = DateTime.Today.AddHours(0);
post.Title = textBox1.Text;
post.Body = richTextBox1.Text;
post.Categories = new string[] { secilikat };
var cfs = new CustomField[]
{
new CustomField()
{
// Don't pass in ID. It's auto assigned for new custom fields.
// ID = "name",
Key = "post_thumbnail",
Value = linkToImage
}
};
post.CustomFields = cfs;

Categories

Resources