Turn custom link to formula field - salesforce

I have created a custom link for a custom object and it works. But it's not controlled by FLS so I have to move to Formula field.
What should I do to turn it to a formula field?
Here's my custom link codes:
https://sanofi-pharmachina--dev1.cs5.my salesforce.com/a0C?rlid=01I7F000002B91V&id={Account_Plan_vod__r.Account.ID!}
a0C is object code
01I7F000002B91V is object ID
{Account_Plan_vod__r.Account.ID!}
How should I turn this to a formula field with proper codes?
Thanks!

The HYPERLINK formula, this should work. It shows your link as a clickable url on the detail page of a record:
HYPERLINK("/a0C?rlid=01I7F000002B91V&id=" & Account_Plan_vod__r.Account.ID,"Link Text here")

Related

Oxygen - Advanced Custom Fields Repeater sub-fields - link fields

WordPress Repeater link fields: For testing purposes I have defined one link as an Array and the second link as URL. When adding the repeater to a template the output of one link is an Array and the other link is displayed as URL instead of the actual "link text". The link also doesn't open link in new tab as defined.
What's wrong with this setup? See attachments
Working solution to the problem described above:
It is important to know that my issue with ACF and Repeater is related to the Wordpress Oxygen builder.
In order to get get link fields with target blank you need to do the following:
CPT UI > create post type (set has Archive = true)
Custom Fields > Add field type Repeater, add sub-fields = field type set to text
Posts > Add Rows with link custom fields
Create Template > Add repeater to page, add text link module, set data to appropriate Field Name
Define link target: Add JS code block and add the following code
jQuery('a').each(function() {
var a = new RegExp('/' + window.location.host + '/');
if (!a.test(this.href)) {
jQuery(this).attr("target","_blank");
}
});

How to create a map in controller.js from dynamic form in index.html?

I am creating a dynamic form from angular in index.html using ng-repeat over an array of JSON object. On submit button, I need to pass form data into a post request in form of a map like :
{"key":value,"key":value}
The key is dynamic label generated in the form and value is the input from a text field or drop-down. Please help me. How I can create a map dynamically? You can find my code here.
I solved my problem. This was a little bit tricky to create a map from dynamic form. Code has been updated on plunker.
Step:
I declared a json object response at script.js.
Response[filed.attributeLabel] will work as a key and value will be bind when we select or enter some thing in dropdown or text filed avvording to key in scope variable.

Google tag manager button reference

I'm trying to get google tag manager to track a couple of different buttons on a site. We're currently unable to change the site to aid with this, so we have to find a solution solely with tag manager.
There are several buttons on the site all with the same format as to the two below.. they all have "submit" as the type and a unique term for value so I'm trying to use the tag manager Form Listener which picks up on type="submit". Is there any variable I can use to pull the value field into my event so I can create individual goals in analytics?
etc etc
Any help is greatly appreciated.
You can use built-in variable "Click Element", then create custom JS-variable:
function(){
try{
return {{element}}.getAttribute("value"); //I am not sure now if it is {{element}} or {{Click Element}}
}catch(err){}
}
This will give you a value attribute of clicked button.
Maybe a useful link by Simo Ahava:
http://www.simoahava.com/analytics/track-form-engagement-with-google-tag-manager/#3
You can use built-in auto-event variable Element Attribute to get value. And be sure to use click tracking and not form tracking, because you want to track button clicks and not form submissions.

Set focus on autocomplete field

I have a form that has some fields.
One field is autocomplete
.
The field is filled with information from a table
$f->addField('autocomplete','idfield','Field')->setValueList( $this->api->db->dsql()
->table('items')->field('id,name')->do_getAssoc() );
I'm trying to set the focus on that field when the page loads.
I have did this
On top of the page
$p->js()->_load('seteo_foco');
And then
seteo_foco.js
$(function(){
$("select:first").focus();
})
But this does not work.
Anybody can help ?
Thanks
Try TRUE like
$this->js(true)->_load('seteo_foco'); to load js file.
But in your js code your selector is incorrect. You need to specify you unique field. I'd use something like $form->getElement('field_name')->js(true)->focus(); on the page after the form has been initialized.

How can i have a link field in a content type display a default text when the field is empty

How can i have a link field in a content type display a default text when the field is empty.
For now i have a field as a link - and the link is set to have a static title. This Works fine.
But i'd like to display a default title if the field is empty with no link (but still rendered as a link/button).
It's not a view - so i can't use "rewrite output if empty".
I'm a newbee to drupal - so please help
This shows what I've got so far:
http://1fb72c32b5e90467b795f388746f7501b3ad8021.web9.temporaryurl.org/tmp/link2.PNG
When the link field is empty the button doesn't show. Instead of not showing when empty I'd like it to show someting like this as default:
http://1fb72c32b5e90467b795f388746f7501b3ad8021.web9.temporaryurl.org/tmp/link3.PNG (the button "Bestil på tlf...")
By simply using Link module, i don't think this is possible. But, follow below steps in your environment and i think you might achieve the goal:
Make custom template file for the page (i think, its product details page)
In that template file, check whether the link is empty or not
If link is not empty, show the link. If link is empty, show your custom HTML.

Resources