I have a Opportunities that my team is working and what I would like to do it have a button that says "Called" or "emailed" and when clicked it would create and activity on the record with a pre-written subject and status. This way the last activity date field gets updated on the opp and I can also allow f the r team to quickly mark opps. as Called or sent an email rather than the other traditional way of doing all the clicking. Is this possibel and how do I make this happen please?
-
110 Points
Posted 2 years ago
-
454 Points
Yes, this sounds possible and quite easy. I'm assuming you already have a skuid page with the opportunity model. In that Case, do the following:
<skuidpage unsavedchangeswarning="yes" personalizationmode="server" useviewportmeta="true" showsidebar="true" showheader="true" tabtooverride="Opportunity"> <models>
<model id="Opportunity" limit="1" query="true" createrowifnonefound="false" datasourcetype="salesforce" datasource="salesforce" sobject="Opportunity">
<fields>
<field id="Name"/>
<field id="CreatedDate"/>
<field id="LastActivityDate"/>
</fields>
<conditions>
<condition type="param" enclosevalueinquotes="true" operator="=" field="Id" value="id"/>
</conditions>
<actions/>
</model>
<model id="Activity" limit="20" query="true" createrowifnonefound="false" datasource="salesforce" type="" sobject="Task">
<fields>
<field id="Subject"/>
<field id="WhatId"/>
<field id="What.Name"/>
</fields>
<conditions>
<condition type="modelmerge" value="" field="WhatId" operator="=" model="Opportunity" enclosevalueinquotes="true" mergefield="Id" novaluebehavior="noquery"/>
</conditions>
<actions/>
</model>
</models>
<components>
<pagetitle model="Opportunity" uniqueid="sk-2s0QBP-95">
<maintitle>
<template>{{Name}}</template>
</maintitle>
<subtitle>
<template>{{Model.label}}</template>
</subtitle>
<actions>
<action type="delete"/>
<action type="clone"/>
<action type="share"/>
<action type="savecancel" window="self"/>
</actions>
</pagetitle>
<buttonset model="Opportunity" uniqueid="sk-2s0ilk-146" position="center">
<buttons>
<button type="multi" label="Called">
<actions>
<action type="createRow" model="Activity" appendorprepend="prepend" defaultmodefornewitems="edit" affectedrows="context">
<defaults>
<default type="fieldvalue" field="Subject" enclosevalueinquotes="true" value="Called Client"/>
<default type="fieldvalue" field="WhatId" enclosevalueinquotes="true" value="{{Id}}"/>
</defaults>
</action>
<action type="updateRow" fieldmodel="Opportunity" affectedrows="all" field="LastActivityDate" enclosevalueinquotes="false" value="TODAY"/>
<action type="save">
<models>
<model>Activity</model>
</models>
</action>
</actions>
</button>
<button type="multi" label="Emailed">
<actions>
<action type="createRow" model="Activity" appendorprepend="prepend" defaultmodefornewitems="edit" affectedrows="context">
<defaults>
<default type="fieldvalue" field="Subject" enclosevalueinquotes="true" value="Emailed"/>
<default type="fieldvalue" field="WhatId" enclosevalueinquotes="true" value="{{Id}}"/>
</defaults>
</action>
<action type="updateRow" fieldmodel="Opportunity" affectedrows="all" field="LastActivityDate" enclosevalueinquotes="false" value="TODAY"/>
<action type="save">
<models>
<model>Opportunity</model>
<model>Activity</model>
</models>
</action>
</actions>
</button>
</buttons>
</buttonset>
<basicfieldeditor showsavecancel="false" showheader="true" model="Opportunity" mode="read" uniqueid="sk-2s0QBP-96" buttonposition="">
<columns>
<column width="50%">
<sections>
<section title="Basics">
<fields>
<field id="Name"/>
</fields>
</section>
</sections>
</column>
<column width="50%">
<sections>
<section title="System Info" collapsible="no">
<fields>
<field id="CreatedDate"/>
<field id="LastActivityDate" valuehalign="" type=""/>
</fields>
</section>
</sections>
</column>
</columns>
</basicfieldeditor>
<skootable showconditions="true" showsavecancel="true" showerrorsinline="true" searchmethod="server" searchbox="true" showexportbuttons="false" pagesize="10" createrecords="true" model="Activity" buttonposition="" mode="read" allowcolumnreordering="true" uniqueid="sk-2s1cdk-288">
<fields>
<field id="Subject" hideable="true" uniqueid="fi-2s1psn-310"/>
</fields>
<rowactions>
<action type="edit"/>
<action type="delete"/>
</rowactions>
<massactions usefirstitemasdefault="true">
<action type="massupdate"/>
<action type="massdelete"/>
</massactions>
<views>
<view type="standard"/>
</views>
</skootable>
</components>
<resources>
<labels/>
<css/>
<javascript/>
</resources>
<styles>
<styleitem type="background" bgtype="none"/>
</styles>
</skuidpage>
- Create a Task Model
- Set a condition that WhatId is in Opportunity
- Create a button set on the page, with Opportunity as Model.
- Add Called and Emailed buttons.
- For each button add the following actions
- Create new row in Task Model, populate pre-written fields
- Update row in Opportunity Model, Update Last activity date
- Save both models.
<skuidpage unsavedchangeswarning="yes" personalizationmode="server" useviewportmeta="true" showsidebar="true" showheader="true" tabtooverride="Opportunity"> <models>
<model id="Opportunity" limit="1" query="true" createrowifnonefound="false" datasourcetype="salesforce" datasource="salesforce" sobject="Opportunity">
<fields>
<field id="Name"/>
<field id="CreatedDate"/>
<field id="LastActivityDate"/>
</fields>
<conditions>
<condition type="param" enclosevalueinquotes="true" operator="=" field="Id" value="id"/>
</conditions>
<actions/>
</model>
<model id="Activity" limit="20" query="true" createrowifnonefound="false" datasource="salesforce" type="" sobject="Task">
<fields>
<field id="Subject"/>
<field id="WhatId"/>
<field id="What.Name"/>
</fields>
<conditions>
<condition type="modelmerge" value="" field="WhatId" operator="=" model="Opportunity" enclosevalueinquotes="true" mergefield="Id" novaluebehavior="noquery"/>
</conditions>
<actions/>
</model>
</models>
<components>
<pagetitle model="Opportunity" uniqueid="sk-2s0QBP-95">
<maintitle>
<template>{{Name}}</template>
</maintitle>
<subtitle>
<template>{{Model.label}}</template>
</subtitle>
<actions>
<action type="delete"/>
<action type="clone"/>
<action type="share"/>
<action type="savecancel" window="self"/>
</actions>
</pagetitle>
<buttonset model="Opportunity" uniqueid="sk-2s0ilk-146" position="center">
<buttons>
<button type="multi" label="Called">
<actions>
<action type="createRow" model="Activity" appendorprepend="prepend" defaultmodefornewitems="edit" affectedrows="context">
<defaults>
<default type="fieldvalue" field="Subject" enclosevalueinquotes="true" value="Called Client"/>
<default type="fieldvalue" field="WhatId" enclosevalueinquotes="true" value="{{Id}}"/>
</defaults>
</action>
<action type="updateRow" fieldmodel="Opportunity" affectedrows="all" field="LastActivityDate" enclosevalueinquotes="false" value="TODAY"/>
<action type="save">
<models>
<model>Activity</model>
</models>
</action>
</actions>
</button>
<button type="multi" label="Emailed">
<actions>
<action type="createRow" model="Activity" appendorprepend="prepend" defaultmodefornewitems="edit" affectedrows="context">
<defaults>
<default type="fieldvalue" field="Subject" enclosevalueinquotes="true" value="Emailed"/>
<default type="fieldvalue" field="WhatId" enclosevalueinquotes="true" value="{{Id}}"/>
</defaults>
</action>
<action type="updateRow" fieldmodel="Opportunity" affectedrows="all" field="LastActivityDate" enclosevalueinquotes="false" value="TODAY"/>
<action type="save">
<models>
<model>Opportunity</model>
<model>Activity</model>
</models>
</action>
</actions>
</button>
</buttons>
</buttonset>
<basicfieldeditor showsavecancel="false" showheader="true" model="Opportunity" mode="read" uniqueid="sk-2s0QBP-96" buttonposition="">
<columns>
<column width="50%">
<sections>
<section title="Basics">
<fields>
<field id="Name"/>
</fields>
</section>
</sections>
</column>
<column width="50%">
<sections>
<section title="System Info" collapsible="no">
<fields>
<field id="CreatedDate"/>
<field id="LastActivityDate" valuehalign="" type=""/>
</fields>
</section>
</sections>
</column>
</columns>
</basicfieldeditor>
<skootable showconditions="true" showsavecancel="true" showerrorsinline="true" searchmethod="server" searchbox="true" showexportbuttons="false" pagesize="10" createrecords="true" model="Activity" buttonposition="" mode="read" allowcolumnreordering="true" uniqueid="sk-2s1cdk-288">
<fields>
<field id="Subject" hideable="true" uniqueid="fi-2s1psn-310"/>
</fields>
<rowactions>
<action type="edit"/>
<action type="delete"/>
</rowactions>
<massactions usefirstitemasdefault="true">
<action type="massupdate"/>
<action type="massdelete"/>
</massactions>
<views>
<view type="standard"/>
</views>
</skootable>
</components>
<resources>
<labels/>
<css/>
<javascript/>
</resources>
<styles>
<styleitem type="background" bgtype="none"/>
</styles>
</skuidpage>
-
884 Points
Nice job Adam! I thought I was actually going to be able to help someone out instead of always getting the help...but, your recommendation above should work!
Related Categories
-
Skuid on Salesforce
- 2274 Conversations
- 181 Followers