Hi,

I have a page "UserPage2" which is created from configuration (Add > Additional > Page). The page having few fields. My aim is to get the values from fields and save as Contact record.

For the purpose on click of Save button I have code in script task.

I tried to get value from a field "FullName" by using 2 ways (screenshot line#5&6) but its not working and compiler is showing error.

 

Any help will be highly appreciable

 

Regards

Like 0

Like

3 comments

Dear Muhammad,

Please try using other, more simple approach using JavaScript language. This might save your time and will provide you with good debug possibilities so help you develop the functionality.

The idea is to override the basic save method on your custom page. Any page inherits from BasePageV2, which has realization of save method. You override it, so to add your custom method along with parent realization.

Such custom method will be taking values from fields by means of this.get() and using InsertQuery to create a new contact with needed data. 

More about InsertQuery realization you can find here:

https://community.bpmonline.com/questions/can-i-insert-records-object-esq-queries

Regards,

Anastasia

Anastasia Botezat,

Thanks for suggestion. Please note that script task is only accept C# code. I'm working on custom Page that I added from Configuration > Add > Additional Page.

I already saved form textfields values but for lookups field its not working. May be you can help on this issue. below is my example code that I copied from script task. Gender is lookups field.

string UsrFullName = Page.UsrFullName.Text;

Guid UsrGender = (Guid)Page.LookupEdit1.Value;

var entity = UserConnection.EntitySchemaManager.GetInstanceByName("Contact");

var contact = entity.CreateEntity(UserConnection);

contact.SetDefColumnValues();

contact.SetColumnValue("Name", UsrFullName);

contact.SetColumnValue("Gender", Guid.Parse(UsrGender.ToString()));

contact.Save();

return true;

Muhammad Shajiuddin,

Firstly, this is an old and no longer supported version of pages. We highly do not recommend to use them. There is new functionality in the system for page creation. You can use Section Wizard for this purposes and use the approach I have described previously.

Secondly, this is an obsolete tool that presents in the system mostly for backward compatibility.

Regards,

Anastasia

Show all comments