Custom Block with Custom parameters

Hi, all
Is there any way to provision any Custom Values to Custom Field type. For example, I have a Custom Field Type that should return a list of items.

The problem is for each user I want to return a different list of items. For example, based on User ID or some other Monday Identities I want to identify User or Entity the User belongs to and return corresponding list.

BR,
Alexey

1 Like

Hey there @azelenkin0306 :wave:

That’s quite an interesting question! I hope you don’t mind me asking, but it would be really helpful if you could provide more context to your request here. That would allow us to get a much deeper understanding of what you are trying to accomplish in this case. I hope that makes sense :slight_smile:

-Alex

Hi @azelenkin0306

You have access to accountId and userId in the request that is sent to you when user clicks the custom field type in the recipe. You need to provide an endpoint in the custom field type (dropdown) like this:

router.post("/master-detail/get-watchlist", authenticationMiddleware, masterDetailController.getWatchList);

Then in the function specified in the route you have access to accountId and userId after you verified the JWT token in the authorization header. Unfortunately you do not have access to boardId. With the userId you can get the teams where the user belongs to but I do not have an example for that. Snippet below shows all board where the boardIds are stored in an SQL table (function masterDetailService.getWatchList).

async function getWatchList(req, res) {
try {
const { authorization } = req.headers;
if (!authorization && req.query) authorization = req.query.token;
const { accountId, userId, aud, exp, iat } = jwt.verify(authorization, process.env.MONDAY_SIGNING_SECRET);
req.session = { accountId, userId, aud, exp, iat };
} catch (err) {
res.status(401).json({ error: “not authenticated” });
}
const routePath = “https://” + req.headers.host + req.route.path;
if (req.session.aud !== routePath) return res.status(401).json({ error: “not authenticated” });
watchList = await masterDetailService.getWatchList(req.session.accountId);
return res.status(200).send(watchList);
}

1 Like

@basdebruin wow, thanks so much for jumping in and sharing! You’re always there to help out and I really appreciate it.

-Alex

Sure.
We have a separate Board called Workflows. This board is populated by our service. Then we have several Boards with field called Workflow which is a Link to specific item in Workflows board

This is how it looks like:

I want to create an Integration Recipe that does the following: When new item is created in specific board, update Workflow column of added item with the value taken from Workflows board. By using this recipe we’re planning to automate the connection between Tasks and Workflows that will be invoked once the Task needs to be validated.

I’ve been told by @dipro that I can use the Custom Field Type for this, but the problem is the same as @basdebruin mentioned. These workflows can be different for each user/organization/entity and since we can’t send any identities in Custom Field type, on server I can’t differentiate which set of workflows should be returned.

@basdebruin: Thanks for reply. This may work, but it introduces additional complexity to our functionality being already pretty complex

1 Like

Hi, @AlexSavchuk
Any updates? Is it possible to achieve this kind of functionality?

Hi @azelenkin0306!
We’re going to release soon a possibility to add dependencies for your field type. For example, you can say that before clicking on your field type the user will have to first enter the data for a different field type and then you’ll receive it on the request to your endpoint :slight_smile:

Hi @edogr1, Edo

That is great news !!. While you are visiting the custom field types please have a look at the bug I reported to support this week (multiples column types in one recipe does not work).

Also, it would be very helpful if you can send the boardId of the board where the recipe is configured to in the payload of the request to the endpoint. In this way I can return options depending on the boardId :slight_smile:

1 Like

@basdebruin I’m glad Edo’s update here was helpful! Thank you for pointing those out for us as well! I’ll take a further look from my end and post those as tasks in our roadmap to consider and make further improvements on :slight_smile:

-Alex