create records using a custom button

  • 1
  • Question
  • Updated 2 years ago
  • Answered
  • (Edited)
Using the table component, I want to be able to create new records (in this case, new task records) via a custom button and without having to do a pop up. The + has some logic that I'm assuming can be recreated via the action properties without using a popup or using javascript instead. Can someone point me in the right direction or help me in creating one of the two options? Thanks!

Photo of ns

ns

  • 1,822 Points 1k badge 2x thumb

Posted 2 years ago

  • 1
Photo of Gregg Baxter

Gregg Baxter, Official Rep

  • 3,080 Points 3k badge 2x thumb
Hi Roger

I would look at Model Actions, Row Actions or Button Actions for this.

You could set the Model Action to listen for a save or create on the table data and then trigger a create a record on Tasks action and populate the fields.

or

Create a row action with the same functionality

or 

Create a Button with the same functionality.

ciao
Photo of ns

ns

  • 1,822 Points 1k badge 2x thumb
I currently have this setup on the table row action as a default. I'm trying to create a custom button, as the current default + button is really small and users are wanting a larger button.
Photo of Gregg Baxter

Gregg Baxter, Official Rep

  • 3,080 Points 3k badge 2x thumb
Hi Roger

You can use JS and CSS to replace the + button but I wouldn't recommend doing that as you will need to keep this up throughout your org to keep uniformity which can become difficult to manage.  

What I recommend doing is create a few 'out of the box' samples using the button component, etc... and have a small workshop with your users and let them choose the best method for record creation. That way you keep the users happy, you avoid having to document and audit custom hacks and it is easier for other developers to follow.

Hope that helps.
Photo of ns

ns

  • 1,822 Points 1k badge 2x thumb
One use case is the creation of multiple records without the use of pop ups. Users want to remain on the same page when the records are saved. I agree in what you said with avoiding additional documentation and tracking custom builds, it's a hassle for anyone to maintain when it's not their own work. But was hoping something was in the works or already created in the community for easy same page record creations.
Photo of Gregg Baxter

Gregg Baxter, Official Rep

  • 3,080 Points 3k badge 2x thumb
Hi Roger

Here is a page with the ability to create multiple records on the same page.

Hope this helps.

<skuidpage unsavedchangeswarning="yes" personalizationmode="server" showsidebar="true" useviewportmeta="true" showheader="true">    <models>
        <model id="ContactsModAM" limit="20" query="true" createrowifnonefound="false" datasource="salesforce" type="" sobject="Contact">
            <fields>
                <field id="FirstName"/>
                <field id="LastName"/>
                <field id="Phone"/>
            </fields>
            <conditions/>
            <actions/>
        </model>
    </models>
    <components>
        <buttonset model="ContactsModAM" uniqueid="sk-4rPkK-145">
            <buttons>
                <button type="multi" label="New Contact" icon="sk-icon-add">
                    <actions>
                        <action type="createRow" model="ContactsModAM" appendorprepend="prepend" defaultmodefornewitems="edit" affectedrows="context"/>
                    </actions>
                </button>
                <button type="save" label="Save" window="self" icon="sk-icon-save"/>
                <button type="cancel" label="Cancel" window="self" icon="sk-icon-cancel"/>
            </buttons>
        </buttonset>
        <skootable showconditions="true" showsavecancel="true" showerrorsinline="true" searchmethod="server" searchbox="true" showexportbuttons="false" pagesize="10" createrecords="true" model="ContactsModAM" buttonposition="" mode="read" allowcolumnreordering="true" uniqueid="sk-4rDPS-111">
            <fields>
                <field id="FirstName" hideable="true" uniqueid="fi-4rKBz-131"/>
                <field id="LastName" hideable="true" uniqueid="fi-4rKBz-132"/>
                <field id="Phone" hideable="true" uniqueid="fi-4rKB_-133"/>
            </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/>
        <javascript/>
        <css/>
    </resources>
    <styles>
        <styleitem type="background" bgtype="none"/>
    </styles>
</skuidpage>
Photo of ns

ns

  • 1,822 Points 1k badge 2x thumb
Hi Gregg!

Man are you kidding me?? This is freaking awesome! Didn't expect a fully created page with custom button. Much appreciated!

Thank you!
(Edited)