RedMine Create Issue Containing HTML through API - redmine

I have a webhook which automatically opens tickets from our customer support software Freshdesk in Redmine. The description from the support software is sent containing plain HTML. When passing this to the Redmine API to create an issue, the description is created with the HTML and it is very difficult to read.
Example in request:
{
"issue":
{ "project_id": 62
, "priority_id": 6
, "tracker_id": 12
, "status_id": 6
, "assigned_to_id": 23
, "subject": "Freshdesk - {{ticket.subject}}"
, "description": "Product - {{ticket.portal_name}}\n\nDescription:\n<div>this is a div</div>\n\nLast Public Comment\n{{ticket.latest_public_comment}}\n\nLast Private Comment\n{{ticket.latest_private_comment}}\n\nAgent Email - {{ticket.agent.email}}\nFreshdesk URL - {{ticket.url}}"
}
}
In Redmine:
Product - Product Name
Description: <div>this is a div</div>
Last Public Comment public comment
Last Private Comment Private comment
Agent Email - agentemail#ticket.com
Freshdesk URL - www.freshdesk.com

Note: This issue is not linked to the Redmine API. You would have the same problem if you were to copy paste this directly into the issue description field.
What you want to achieve is not possible natively, as div tags are escaped.
You would need to change this line and add in the tags you want Redmine to keep:
ALLOWED_TAGS = %w(redpre pre code notextile div form input)
Be careful though, as this could mess up your layout and/or be potentially unsafe.

Related

How to post a photo to a page with a tagged Product via Graph API v12.0?

We have a Facebook Shop and a Business Page, and are using Facebook Graph API to create Photo posts on the Business Page using the Javascript SDK running in a browser. How do you include the tagged Product in the Create Photo request?
https://developers.facebook.com/docs/graph-api/reference/photo/ mentions a tags field you can pass which is described as "Tags on this photo", however it has a tag_uid "The user_id of the tagged person". Is this tags field how you are supposed to tag a product?
A similar question from 2017 was not answered and is so old I thought I'd post a new one: Publish new facebook post with tagged product
What we've tried so far
To get a list of our products, we can use GET ${businessId}/owned_product_catalogs to retrieve a list of catalogs, and then GET ${productCatId/products with a filter: '{"custom_label_0":{"eq":"something_to_match"}}' to get a specific product in the catalog. So now we have the ID of a product we want to tag e.g. "4378279312278116". (we happen to use custom_label_x fields meaningfully, of course the filter could have been something else but this works for us)
To create the photo post, we can POST /${account.id}/photos with a payload like:
{ caption: 'Test caption',
url: image_url,
access_token: account.access_token,
tags: [
{
tag_uid: "4378279312278116",
tag_text: 'Test tag',
x: 10, y: 10
}
]
}
This request completes OK and does post the photo, but nothing is tagged on it when we view it on our page.
Trying to read the photo with GET ${photo_id} only returns basic infomation fields created_time, id, name. I can't see how to read further fields on the photo object to check if the tags data was associated with it correctly.
Any advice please?

HelloSign Templates - Not showing Me (when sending)

My app is being set up to use HelloSign through it's API. I'm trying to create a Template using a PDF I have. My goal is to have fields in the PDF that I can pre-fill in before sending it to the customer to their signature. I'm going to pre-fill things in like their full name, their account #, etc.
I've uploaded the PDF into the Template tool and added the custom fields using the GUI tool. However, as I've found on the documentation and other StackOverflow questions, I need to set these custom fields to "Me (when sending)" in the Assigned to setting. However, for me, this option doesn't appear at all (See image).
As a result, when my API calls the sendWithTemplate function with this as one of the parameters, I'm getting an error of "Invalid custom field parameters".
I'm on the Pro plan currently. Also, if HelloSign is reading this, you should let people on a free account use a template in test mode or something, no reason to make me sign up with CC to test using templates.
const opts = {
test_mode: 1,
template_id: templateId,
clientId: '<my client id>',
subject: 'Test Document',
message: 'Sign this test document',
signers: [
{
email_address: 'email#email.com',
name: 'Klay'
}
],
custom_fields: [
{ personName: "Klay Curry" }
]
};
HelloSign.signatureRequest.sendWithTemplate(opts).then((res) => {
console.log("RES", res);
}).catch((err) => {
console.log("ERR", err);
});
I'm a HelloSign API support engineer and happy to help.
Apologies, we are updating our documentation, but the custom field should be set to "Sender" which is the same as "Me (when sending)".
Also, the custom_fields object should be set like so with NodeJs:
custom_fields = [ { "name" : "personName", "value" : "Klay Curry" } ]
As for your piece about letting folks on a free account use a template in test mode, I believe if you just create a template past your template limit, it will automatically say that the template is locked and can be used in test_mode.
I will also reply to you on the ticket you opened for this.

Can't Get 1:m VTiger Relationship to Show on "1" Side

I am trying to implement a 1:m relationship between Contacts & Service Contracts in VTiger 6. We will use the relationship to track Users of our system. Each Contact should only be allowed to be link to 1 Service Contract at a time (1:m).
I was able to get the ServiceContract side of this working by using the following code:
require_once 'vtlib/Vtiger/Module.php';
$scmodule=Vtiger_Module::getInstance('ServiceContracts');
$scmodule->setRelatedList(Vtiger_Module::getInstance('Contacts'), 'Users',Array('SELECT'),'get_related_list');
This added a tab on the right side of Service Contracts titled "Users" with a SELECT button and allows us to ADD/REMOVE Contacts from the list.
However, what we would also like is to have a field on the Contacts page that shows which Service Contract they are linked to.
UPDATE:
I used the following code to add a single Service Contract field to Contacts:
`
include_once('vtlib/Vtiger/Module.php');
$module = Vtiger_Module::getInstance('Contacts');
$blockInstance = Vtiger_Block::getInstance('LBL_CONTACT_INFORMATION', $module);
$fieldInstance = new Vtiger_Field();
$fieldInstance->name = 'SelectYourAccount';
$fieldInstance->label = 'Account';
$fieldInstance->uitype = 10;
$fieldInstance->typeofdata = 'V~O';
$blockInstance->addField($fieldInstance);
$fieldInstance->setRelatedModules(Array('ServiceContracts'));`
The above code worked fine and I have an Account field in contact details that I can link to a single Service Contract; however, when I select a Service Contract for a Contact and then go to the Users list on the Service Contract, the Contact isn't listed.
Any help would be greatly appreciated!
What i understand from your Question is that Contact is your "1" module and Service Contract is "M(Multi Record)" module. Which means 1 Contact will have multiple Service Contract. So in vtiger Service Contract Related List is already given under Contact Module.Please check this image below.
Next in Service Contract you will have Option to select Contact so that Contract will be liked with "1" Contact. See Screenshot here.
I Hope you will get clear picture after reading this of Relation in Vtiger.

WSO2 APIM Store - limited email address validation

deploying an internal (corporate) API manager 2.0.0 we found a limitation - the email address validation apparently enforces email validation with 2-4 email :
/store/site/themes/wso2/templates/ui/validation/custom-validation.js:
$.validator.addMethod('validEmail', function(value, element) {
var emailRegex = /^([A-Za-z0-9_\-\.])+\#([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
return emailRegex.test(value);
}, i18n.t('Invalid email address'));
However - email addresses today may have even long last domain name (e.g. someuser#stad.gent, otheruse#my.internal.corporation)
I see the validation logic is implemented in the followinf file:
repository/deployment/server/jaggeryapps/store/site/themes/wso2/templates/ui/validation/custom-validation.js
Question: is the file the only place where the email format is enforced? (Users are managed in AD, so the default user view / management UI doesn't concern us too much atm)
Seems the only place where the email is validated is the script:
repository/deployment/server/jaggeryapps/store/site/themes/wso2/templates/ui/validation/custom-validation.js

Facebook API: Error "(#210) Subject must be a page" when posting a Status Update on a Page

I want to post a simple status update on one of my pages with a perl-script. To find out how to do best, I use facebooks Graph API Explorer https://developers.facebook.com/tools/explorer for experiments
I use the access token of my FB-app. This app is doing a good job since 2 years. The access token will expire in about 2 month and among many other permissions it has the permissions "publish_stream" and "manage_pages".
I select "POST", then, in the field next to "POST", I enter the ID of my page (a 15-digit-number starting with 102 ending with 937). This ID is correct, because I can GET data from this page using exactly this ID.
I click on "Add a field", then I enter the field-name "message" and the value "test-message". Then I click on "Submit". And then I get this result:
{
"error": {
"message": "(#210) Subject must be a page.",
"type": "OAuthException",
"code": 210
}
}
But posting a comment to an existing posting on the same page works fine. I simply replace the page-ID 102...937 with 501...852/comments where "102...937" and "501...852" are 15-digit-numbers.
What am I doing wrong? What must I do to post a message on my page using the Graph API Explorer? "102...937" is the ID of an existing page. I am managing 3 pages, I have the same problem with all 3 IDs.
I found the solution:
In the field next to POST I only did enter the Page-ID (like 123456789012345) but you must add "/feed" to the end, like this: 123456789012345/feed
The documentation does not say how to post a status message. To me it was clear, If want to post something on a page, I have to enter the pages ID, not more. And if the error-message would have said "Subject must be a FEED" everything would have been clear. But is said "must be a PAGE" but it already was a page.