You can change that by adding a handler like this - note this will change the value from "New record" when adding a new record for the page:
handlers:/**SCHEMA_HANDLERS*/[{
request:"crt.HandleViewModelInitRequest",
handler: async (request, next)=>{const result = await next?.handle(request);const cardState = await request.$context.CardState;if(cardState =="add"|| cardState =="copy"){
request.$context.HeaderCaption="Add a new something";}return result;}}]/**SCHEMA_HANDLERS*/,
As far as binding it to some page value, you could use the same but first get a value from the page. Something like this:
handlers:/**SCHEMA_HANDLERS*/[{
request:"crt.HandleViewModelInitRequest",
handler: async (request, next)=>{const result = await next?.handle(request);const cardState = await request.$context.CardState;if(cardState =="add"|| cardState =="copy"){
request.$context.HeaderCaption="Add a new something";}else{// get a value from the pageconst someValue = request.$context.someAttributeOnThePage;
request.$context.HeaderCaption= someValue;}return result;}}]/**SCHEMA_HANDLERS*/,