Trying to create a task page for tasks only related to a certain object?

  • 1
  • Question
  • Updated 3 years ago
I would like to create a skuid page for tasks only related to our "Employee_Location" object. So far, I have created a new task record type for "Employee_Location", however I am not finding a way to automate salesforce into setting the correct record type when a task is created. So far my research has lead me to believe this is difficult or impossible.

Is there a workaround in Skuid where I can create different task pages for tasks which are related to different objects?

Thanks,
Shane
Photo of Shane Newman

Shane Newman

  • 200 Points 100 badge 2x thumb

Posted 3 years ago

  • 1
Photo of Skuidward Tentacles (Raymond)

Skuidward Tentacles (Raymond), Champion

  • 17,224 Points 10k badge 2x thumb
You should be able to bring the record type field into your Skuid model, then place a condition on the model where record type equals Employee_Location. Then any new record created in your Skuid model should automatically populate that field with Employee_Location.
Photo of Shane Newman

Shane Newman

  • 200 Points 100 badge 2x thumb
Yup, and that's not a problem at all. The problem is that I don't want users in salesforce to have to manually set the record type for tasks. I was wondering if there is a way around having to write an apex trigger in salesforce to automatically set the record type when a task is related to a specific object.
Photo of Skuidward Tentacles (Raymond)

Skuidward Tentacles (Raymond), Champion

  • 17,224 Points 10k badge 2x thumb
No, if you want the record type to be set dynamically based on the value chosen in another field, you will have to use an apex trigger I believe.
Photo of Ryan Denis

Ryan Denis

  • 542 Points 500 badge 2x thumb
Hi Shane,

I asked a similar question recently: https://community.skuid.com/skuid/topics/display-tasks-from-a-specific-object But do you mean a detail page of a task, or a list view? If it's a list view you may not have to use record types at all.

As Rob said in that thread you should be able to make a condition that goes through the "WhatId" and limits records by "Type". The type would be Employee_Location__c I believe.

Doing this allowed me to split a task manager page in to different tabs for different objects. 

(Edited)
Photo of Shane Newman

Shane Newman

  • 200 Points 100 badge 2x thumb
Hi,

I'm trying to create a detail page of a task.

Thanks
Photo of Ryan Denis

Ryan Denis

  • 542 Points 500 badge 2x thumb
Ah ok. Well I haven't tried this but it might work.

You could try process builder. The criteria for each step could be if the whatID starts with ...... So if the whatid starts with a01 update record type to____. Etc. 

You could also use workflows but would have to create a formula field that copies the whatid to the task object first.
(Edited)
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Here is a scenario (As I understand it). 

Field A is set. 

A button then creates a task - and the value of Field A determines what Record Type the new task should take. 

I think you can do this if Field A is a picklist and you are wiling to override the metadata - you could change its value (not its label) to be the recordTypeId.  And then when the button is pushed, run an action sequence that updates the "record type condition" on the task model with the value from this field.  And then create the new task. 

More complicated versions of this idea should be possible in Javascript.  I don't think you need to go to Apex.  Your javascript would just need to have a case statement that selected the correct record type ID value,  and then run an "UpdateCondition" on the task model..   Lots of examples on the community of those things..