Question

Hello,

Dear community; 

 

I've one question; I've a source code in my platform, where I coded a function that can delete Asset, this function is running well when nothing is linked to the Asset, 

For example if I link the heater type to one asset, the function doesn't work. 

I would quote that I run the function by postman, and there are few errors that I dont understand 

 

There is one message of an error : 

 

 

Here you can find my source code of my function : 

        public string DeletingAsset(string idAsset)
        {
            var userConnection = (UserConnection)HttpContext.Current.Session["UserConnection"];
            var delete = new Delete(userConnection)
                .From("yooAsset")
                 .Where("Id").IsEqual(Column.Const(idAsset));
            var cnt = delete.Execute();
               return $"Asset with idAsset {idAsset} were deleted. {cnt} rows affected";
        }

Like

4 comments

Hello Rocher,

It is base SQL message that the record you are trying to delete is used as a value of yooAssetId column of yooHouseProtectionInAsset table. To resolve this error simply firstly update yooAssetId column of yooHouseProtectionInAsset table record value to NULL where yooAssetId column value is equal to the value you are trying to delete. Or modify your logic so that all records from yooHouseProtectionInAsset  table that refer to the value you are trying to delete (via column yooAssetId) could be automatically deleted when you delete the value when using:

public string DeletingAsset(string idAsset)
        {
            var userConnection = (UserConnection)HttpContext.Current.Session["UserConnection"];
            var delete = new Delete(userConnection)
                .From("yooAsset")
                 .Where("Id").IsEqual(Column.Const(idAsset));
            var cnt = delete.Execute();
               return $"Asset with idAsset {idAsset} were deleted. {cnt} rows affected";
        }

Best regards,

Oscar

Oscar Dylan,

Maybe I dont explain my problem well, the Asset will be always connected to several detail, I want to know how can I delete this Asset properly just this Asset and not the records which are linked to

Rocher,

Then you simply need to update yooAssetId column value to NULL for the record in yooHouseProtectionInAsset table where yooAssetId = 'value you are trying to remove'. As a result main record you are trying to delete will be deleted and at the same time nothing will be deleted from 

yooHouseProtectionInAsset table.

Best regards,

Oscar

Oscar Dylan,

That's not my question.. 

I want to delete the data in the table yooAsset, and the data in the all related table. So I'm asking is there parameters for deletion request that permit cascading deletion ?

Log in or register to comment
Question

How can I ass a column for all users ?

Like

1 comments

Dear Artak,

You can find the guide on how to add the new columns on a record page for all users here:

https://academy.creatio.com/documents/administration/7-15/how-configure-section-pages

Dean

Log in or register to comment
Question

I'm sure this is simple, but I could use someone to point me in the right direction. I noticed on certain columns there is a little green arrow in the top right corner and if you click on it you can have a text box with an explanation about what the column is. Is this something I can configure on other columns? How would I do that?

 

 

Like

2 comments

Thank you Vladimir Sokolov!

 

Log in or register to comment
Question

Hi,

I'm going through the documentation https://academy.creatio.com/documents/technic-sdk/7-13/creating-detail-selection-lookup to implement similar solution. What i would like to add is another column on lookup list where user will have possibility to add amount. I gues that this should be something like virtual column in edition mode.

Is this a possible to achive such way ?

Regards,

Marcin Kott

Like

0 comments
Log in or register to comment
Question

Hi,

I have a requirement to route a newly created lead automatically to sales department. I am unable to find any connection to organization structure.

can we use the whole structure apart from access rights?

Thanks

Like

1 comments

Organization structure (users, functional and organization roles) are located in "System administration object". But what do you mean "route to sales department"?

 

Log in or register to comment