# Running workflow through a custom field in CRM Development

**URL:** <https://community.hubspot.com/t/running-workflow-through-a-custom-field-in-crm-development/98544>\
**Category:** CMS Development\
**Tags:** local-development\
**Created:** [January 24, 2024, 12:54pm UTC](https://community.hubspot.com/t/running-workflow-through-a-custom-field-in-crm-development/98544 "2024-01-24T12:54:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![VladislavGavrin](https://avatars.discourse-cdn.com/v4/letter/v/b9bd4f/32.png) [@VladislavGavrin](https://community.hubspot.com/u/VladislavGavrin)\
**Post date:** [January 24, 2024, 12:54pm UTC](https://community.hubspot.com/t/running-workflow-through-a-custom-field-in-crm-development/98544/1 "2024-01-24T12:54:14Z")

</div>

Please tell me if there is any way to start workflow through own button or toggle switch?

```lia-code-sample
import React, { useState, useEffect } from 'react';
import {
 Button,
 Text,
 hubspot,
} from '@hubspot/ui-extensions';

hubspot.extend(({actions}) => (
 <Extension
 fetchProperties={actions.fetchCrmObjectProperties}
 />
));

const Extension = ({ fetchProperties }) => {
 const post = "https://api.hubapi.com/automation/v2/workflows/:workflowsID/enrollments/contacts/";
 const [email, setemail] = useState("");
 useEffect(() => {
 fetchProperties(["email"])
 .then(properties => {
 setemail(properties.email);
 });
 }, [fetchProperties]);

 function myOnClickFunction() {
 fetch(post + email, {
 method: 'POST',
 headers: {
 'Accept': 'application/json',
 'Authorization': 'Bearer TOKEN',
 'Content-Type': 'application/json',
 'Content-Length': '0',
 },
 });
}

 return (
 <><Text>Post:{email} </Text><Button onClick={myOnClickFunction}>Enroll</Button></>
 );

}

```

---

<div class="post-metadata">

**Author:** ![Jaycee\_Lewis](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jaycee_lewis/32/61352_2.png) [@Jaycee\_Lewis](https://community.hubspot.com/u/Jaycee_Lewis)\
**Post date:** [January 24, 2024, 10:45pm UTC](https://community.hubspot.com/t/running-workflow-through-a-custom-field-in-crm-development/98544/2 "2024-01-24T22:45:04Z")

</div>

Hey, @VladislavGavrin 👋 Can you tell us more about your project? Are you getting an error? Or is there another issue? Additionally, would this be for enrolling existing or net-new Contacts?

Thanks for the additional details. — Jaycee

---

<div class="post-metadata">

**Author:** ![VladislavGavrin](https://avatars.discourse-cdn.com/v4/letter/v/b9bd4f/32.png) [@VladislavGavrin](https://community.hubspot.com/u/VladislavGavrin)\
**Post date:** [January 25, 2024, 5:45am UTC](https://community.hubspot.com/t/running-workflow-through-a-custom-field-in-crm-development/98544/3 "2024-01-25T05:45:34Z")

</div>

Task: by clicking on the button, launch a workflow for a contact.  
I want to enroll the contact in which the button was pressed
