+ Start a Discussion
Amit SAmit S 

Need Values for URLFOR Action.Task

I am trying to ensure a Standard Log a Call functionality for a particular profile under the accounts activities related list "Log a Call" button. But I am not able to get paramters in the URLFOR. I am using the following parameters in the VF Page.

<apex:page standardController="Task"
    action="{!if(contains($Profile.Name,'Exclude Profile'), null, URLFOR($Action.Task.NewTask ,Task.Id, null , true))}" tabstyle="Task" extensions="taskExtension"> 
Best Answer chosen by Amit S
Amit SAmit S
I removed the above logic as it was not working and instead used the Redirect on the New Button and used logic to redirect based on Profile of user.

All Answers

ericmonteericmonte
I think you are using the action attributes wrong on the VF page. When you add an action on the apex page, you are calling an action immediately when the page loads. And I don't think this is what you are trying to accomplish.

https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_page.htm
Amit SAmit S
Hi Ericmonte, Thanks for your time and reply. But it still does not resolve my problem.

My Requirement is to navigate the custom page only for a specific profile, and as per link https://success.salesforce.com/answers?id=90630000000gtAXAAY#!/feedtype=SINGLE_QUESTION_SEARCH_RESULT&id=90630000000gnUUAAY I can provide an alternate functionality based on profile.

But I am unable to use $Action.Task.LogACall ? or something similar to ensure I can replace the Log a Call button. Do you think this is incorrect usage? I am using below header and it help me resolve the functionality partially. 

<apex:page standardController="Task"
    action="{!if(contains($Profile.Name,'~ LID Center'), 
            '', URLFOR($Action.Task.NewTask ,
            Task.Id, 
            null, true))}"
           tabstyle="Task" extensions="taskLTAEditExtension">  

But still having issues with populating the WhoId and Return URL. Also this is working on NewTask Button and not on the Log A Call functionality.

Any further assistance is highly appreciated.

Thanks
 
ericmonteericmonte
The link you are referencing doesn't talk about adding an action command on visualforce page. The link mentions leveraging a new custom button that navigates the user to a specific page.

Visualforce page is not the answer you are looking for, but rather creating a custom button then add the button to specified page layout.
PLEASE REFER TO THIS 
https://help.salesforce.com/HTViewHelpDoc?id=defining_custom_links.htm&language=en_US


And once again, Visualforce page is not your answer. Unless you create a Visualforce Page and would like to create custom action and requires APEX coding throught extensions.
Amit SAmit S
Hi Ericmonte, Thanks for your prompt response.

Giving more details, I need to add a Long Text Area field on the Task Layout and it should be visible only for a particular profile.

I have created the Custom Object having LTA Field, VFpage and Extension Controller to ensure a new record gets created in the custom object and linked to the Task record. This should justify the creation of the VF Page and logic.

To ensure the out-of-box functionlity is retained for all but a specific profile, I am using the action function.

Also, I have replaced the Custom Button with the VF Page. Not sure how only creating a Custom button and Link would help here. 

Based on my problem description hope you can guide on the solution. Appreciate your time.
ericmonteericmonte
Why can't you use the fls for this lets field'? Then when u use the button it will take you to the task and depending on the user profile the fls and visibility kicks in.
Amit SAmit S
I have used the FLS, but not able to relate the custom object with Tasks using master detail relationship and hence not able to create a new record for the LTA Field. Is there a way around it or am I missing something very easy?
ericmonteericmonte
So let me make sure im getting this right. You have a LTA field on task that you were able to set fls on. Now you have a custom object let say inventory, in the inventory record you have this button called my custom button. What do you want this button to do? Do u want it to create a log a call task? And do u want to fill in the what field?
Amit SAmit S
No, SFDC does not allow more than one LTA field on Task, it has only one Comments as LTA field. 

So for me to create LTA2 I had to create a new object2 and use it.

Now to releate Object2 records with Task records all this needs to be done.

The button I am overriding is New Task to ensure LTA2 is shown instead of Comments and LTA2 data gets linked to Task record. Hope this gives you a clear picture of the requirement

 
Amit SAmit S
ericmonte - please refer this link https://developer.salesforce.com/forums/#!/feedtype=SINGLE_QUESTION_SEARCH_RESULT&id=906F00000008mYLIAY
ericmonteericmonte
Okay now I see what you are trying to do. Let me get back to you in the morning. There are other ways to solution this and finding an extreme to the above links is probably not your best solution.
Amit SAmit S
Hi Eric,

Did you explore this further?

Thanks
Amit SAmit S
I removed the above logic as it was not working and instead used the Redirect on the New Button and used logic to redirect based on Profile of user.
This was selected as the best answer