How to extend Task table after Custom table creation?

Nikita28
Mega Guru

Hi,

I want to extend the Task table on a Custom table after its creation.
I have tried executing below code to create extension from Task table to my custom table(x_272304_green_fol_gf_document_status).
But, now system has created a new table(z_x_272304_green_fol_gf_document_status) which extends 'Task' table.


var table = 'x_272304_green_fol_gf_document_status';
var old_parent = '';
var new_parent = 'task';
var changer = new GlideTableParentChange(table);
changer.change(old_parent, new_parent);

Old Custom Table: 'x_272304_green_fol_gf_document_status' is not extended.
New Auto created Table: 'z_x_272304_green_fol_gf_document_status' is extended with Task table.

My all customizations are with the old table. Hence, I am unable to use an old table to create Visual Task Board from the Task table.

Can anyone please suggest a better approach to extend a table after its creation?

Thanks in advance!

1 ACCEPTED SOLUTION

Alok Das
Tera Guru

Hi Nikita,

It is restricted to extend any table after table creation.

However I, saw numbers of threads remained unanswered and numbers of them asked to use background script which results in a duplicate table creation.

Looking up into the issue. I came across an OOB business rule which restricts to extend any table after table creation.


Business Rule: "Table Field Validation"

Disable the piece of code mentioned below:

 

//super class is enter once
if (previous.super_class != current.super_class) {
current.setAbortAction(true);
current.super_class.setError(gs.getMessage('Cannot change what a table extends after it is created'));
gs.addErrorMessage(gs.getMessage('Cannot change what a table extends after it is created'));
}

Now in list layout you can add the task table in the Extends table field.

 

Note: You are modifying the OOB functionality by editing Business Rule: "Table Field Validation", however this is the only possible way.

This will resolve your issue.

 

Kindly mark my answer correct and close the thread.

 

Regards,

Alok

View solution in original post

7 REPLIES 7

Matt62
Kilo Contributor

Hello Alok,

 

Thank you for your help on this issue. I tried this solution in a personal sandbox, and although I was able to extend the Task table to my custom table, all of the custom fields I made to said table had their column labels erased. Whenever I attempt to re-populate the column labels and press save, the dictionary form will reload and the field will appear blank again. The same occurs when trying to edit from the list view (see attached for screen-recording).

 Thanks!

 find_real_file.png

Nare
Tera Contributor

Thank you, Alok

It worked for me.

Nare
Tera Contributor

Hi Alok,

I disabled the script as you provide. After, that I am able to add the task table in extended Table column of the Contract Table. After adding to the contract table. I am missing the existing data belongs to Contract Table. It's showing "No records data". Can you please help me to resolve this problem.

 

 

Thanks,

Nare.