"Feature" Entity contains a reference list field named "MappingTable" which refer to an Entity "Feature_MappingTables".
When call method session->BuildEntity("Feature_MappingTables"),a error will be throw:
Permission denied for user Admin to perform action Submit (of type SUBMIT).
But using same account, I can build "Feature_MappingTables" Entity inside of "Feature" Entity by manually operation,shown as the attachment picture.
My final purpose is to set the fieldvalue of "MappingTable" ,but i failed by trying many times.
How should i do?
This topic has been locked.
Lumart 120000GQG687 Posts
Re: Why i can't build an Entity directly?2012-12-10T10:18:09ZThis is the accepted answer. This is the accepted answer.Please, verify the entity name.
Are you sure that the record you are trying to create is named Feature_MappingTables ?
According to the picture, it looks like the entity name is Feature_BlockMappingTable (see the label on the top window bar).
Anyway, a user is allowed or denied the permission to create a record according to the rules in the ACCESS_CONTROL hook of the Submit action (I mean Submit as an action type, not as the action name, the action might be named Create, for instance), so you should also verify what those rulese are stating.
SystemAdmin 110000D4XK24949 Posts
Re: Why i can't build an Entity directly?2012-12-11T09:43:56ZThis is the accepted answer. This is the accepted answer."Feature_MappingTables" is just a clerical error when i wrote this thread.
In my code,i actually use "Feature_BlockMappingTable".
I post another picture which shows the Action of "Feature_BlockMappingTable" Entity.
The "Accesee Control" field of "SUBMIT" type is "perl",and we can also see its script.
If i want to set the fieldvalue of "MappingTable" in "Feature" Entity,should i take the below steps?:
1. set the Accesee Control to "All Users"
3. setfieldvalue of $BlockEntity and save it.
5. $FeatureEntity->AddFieldValue("MappingTables", "$BlockEntity"); # the field MappingTables is a reference list.
Am I right?
cglockner 2700009784345 Posts
Re: Why i can't build an Entity directly?2012-12-11T12:33:18ZThis is the accepted answer. This is the accepted answer.
- SystemAdmin 110000D4XK
You can delete the access control and set it to all users, but you can also, in the hook you're using to create the entity, call
$session->SetNameValue( "SV_Feature", "1")
This will set the session variable "SV_Feature" to 1, which is what the Access Control hook checks for.