Skip to content

Add script to prefix current subject#5

Open
steglicd wants to merge 1 commit intojobisoft:mainfrom
steglicd:main
Open

Add script to prefix current subject#5
steglicd wants to merge 1 commit intojobisoft:mainfrom
steglicd:main

Conversation

@steglicd
Copy link
Copy Markdown

@steglicd steglicd commented Aug 4, 2025

Script will add "[Custom value]" to the current subject.

May be called like:

[[CSCRIPT=ExtendSubject|Invoice]]

in order to change:

subject = "Order number 123"

to

subject = "[Invoice] Order number 123"

Script will add "[Custom value]" to the current subject.

May be called like:

[[CSCRIPT=ExtendSubject|Invoice]]

in order to change:

subject = "Order number 123"

to

subject = "[Invoice] Order number 123"
@steglicd
Copy link
Copy Markdown
Author

closed since no respnse

@steglicd steglicd closed this Mar 30, 2026
@jobisoft
Copy link
Copy Markdown
Owner

I did not see this earlier, sorry.

@jobisoft jobisoft reopened this Mar 30, 2026
let { relatedMessageId } = await this.compose.getComposeDetails();
let data = await this.messages.getFull(relatedMessageId);

let subject = getOrgHeader("subject")
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you pass in data as well, so we do not rely on global variables?

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getOrgHeader() returns an array, but its return value is used as a string, please join the array entries or pick the first.


let subject = getOrgHeader("subject")
let Prefix = this.quicktext.variables[0];
let FullSubject = Prefix + " " + subject;
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use template strings:

let FullSubject = `${Prefix} ${subject}`;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants