I tried using AI in rules.

When a task is added to a project, I tried inserting the data from a specific task (the due date) into a custom field for the new task.
I confirmed that it worked as expected. (It seems like a waste of AI, but it seems surprisingly useful.)

Please refer to this post for the usage status.

4 Likes

Cool use case but agreed with you re: it being a “waste” (at least resource-wise). I’m personally trying to use script actions in place of AI whenever possible

4 Likes

Hi, @Stephen_Li .
As you say, it might be better to make it into a script.
However, I don’t have the skills to create scripts.
(Personally, my learning has stopped at the old BASIC language level.)
If you don’t mind, could you please make a script for the above AI processing?


When I asked AsanaAI to convert it into a script, they responded with the following:

The Help Center article doesn’t specifically explain how to translate Asana rules directly into JavaScript, but here’s a JavaScript representation of the “Use the due date of task E-D-D” action, as requested:

// Example script to mimic rule behavior using the Asana API
async function copyDueDateFromTask() {
// Initialize Asana API client (authentication is required for actual implementation)
const client = /* Initialize Asana API client */;

// Source task ID
const sourceTaskId = “1210748648125591”; // [E-D-D] task ID

// Target task ID (task this rule applies to)
const targetTaskId = /* Target task ID */;

try {
// Get source task information
const sourceTask = await client.tasks.findById(sourceTaskId);

// Get source task due date
const dueDateToApply = sourceTask.due_on;

// Update the due date of the target task

await client.tasks.update(targetTaskId, {

due_on: dueDateToApply

});

console.log("Task due date updated: " + dueDateToApply);

} catch (error) {

console.error(“An error occurred:”, error);

}
}

// Execute the function

copyDueDateFromTask();

This script uses the Asana API to get the due date from a specific task and apply it to another task. To actually use it, you need to configure Asana API authentication settings and proper error handling.

I know others have been using LLMs to write scripts as non-technical folks (I obv personally think you always want someone with coding knowledge to at least review them but I know that’s not always valid).

I did this quickly and did minimal testing and error handling, but this would be at least a starting point for a script like this:

// UPDATE: enter name of custom date field here
const fieldToFind = "Event Date";

const main = async () => {
    const opts = {
        "opt_fields": "custom_fields, due_on"
    };

    // get task custom fields
    let taskData = await tasksApiInstance.getTask(task_gid, opts);
    taskData = taskData.data;

    const updateBody = {
        "data": {
            "custom_fields": {},
        }
    };

    // get field matching name given above
    const fieldGid = taskData.custom_fields.find(field => field.name === fieldToFind)?.gid;

    // light error handling
    if (!taskData.due_on) {
        log("No due date found");
        return;
    }

    if (!fieldGid) {
        log("No field matches that name")
    }

    // update task with event date set to due date
    updateBody.data.custom_fields[fieldGid] = { date: taskData.due_on };
    try {
        await tasksApiInstance.updateTask(updateBody, task_gid);
    } catch(error) {
        log(error.message)
    }
};

main();
1 Like

Even if it feels like a “simple” use case, automating things like transferring due dates can save a lot of clicks over time — definitely not a waste.

1 Like

I’ve been thinking about a lot of things since yesterday.


The standard feature of Asana’s rule execution action does not allow you to copy data from a task in another project and paste it into a custom field in a new task.

Asana_AI was able to copy data from a task in another project and paste it into a custom field in a new task.

If a person using Asana were to do the same thing as an AI, it would take a lot of time and there would be a risk of making input errors, such as citing different data.

Scripts are useful, but I think it would be difficult to create them for the first time and to change them later. You also need to know scripting syntax. (I (not a systems engineer) can’t use it.)

The commands for Asana_AI take a little time to create the first time, but if you read the commands, you should be able to change them later, even if you’re not a systems engineer.


Addendum
As soon as I started trying out different things, I received an email notification that I had reached my daily limit.

As a countermeasure, I thought it would be a good idea to create rules using AI and convert them into a script once I had confirmed that they worked.

1 Like

Thanks @Stephen_Li.
I was able to get your script to work the way I wanted it to.
This will reduce AI Studio credit consumption.

1 Like

By adjusting these settings depending on your purpose, you may be able to reduce your credit consumption.


Reference Links: 💬 Surface the Latest comment/update of a task using AI Studio

1 Like