How to "allow edit" newly added fields in a form? for Dynamics AX (AX7/D365) - axapta

I've added a new field to my form EcoResProductDetailsExtended, but when I click edit it does not allow me to edit it. The properties for allowing edit is already set to Yes. The form contains the method setAllowEditFields() and setAllowEditField() but it is private so it means I can't make an extension of it nor call it.
Is there anyway or method that I can allow the form to edit my newly added fields?

Check the AllowEdit property in 3 locations:
The table field
\Data Dictionary\Tables\InventTable\Fields\ABCValue
The form datasource field
\Forms\EcoResProductDetailsExtended\Data Sources\InventTable\Fields\ABCValue
The form control
\Forms\EcoResProductDetailsExtended\Designs\DesignList\CostABC_ABCValue
Also, the datasource should allow edit, the Edit button be activated, permissions allow edit etc.

Although method setAllowEditFields is private, it is called from public method setItemStockedDependentObjects. You can create a post-event handler for setItemStockedDependentObjects and make your field editable there.
[PostHandlerFor(formStr(EcoResProductDetailsExtended), formMethodStr(EcoResProductDetailsExtended, setItemStockedDependentObjects))]
public static void Post_setItemStockedDependentObjects(XppPrePostArgs args)
{
// your code here
}

Related

Drupal 8: How to unpublish node when user clicked on Delete button

On my website, The user can add the content and edit the content. On the edit page, there is one delete button to delete the content but I want to use that button to just hide/unpublish the content from the user and the public.
I have tried the below code but it is deleting the content.
function test_entity_predelete(Drupal\Core\Entity\EntityInterface $entity) {
$nid = $entity->id();
$node =Node::load($nid);
$node->setPublished(FALSE);
$node->save();
}
You can try to overwrite action button using hook_form_alter().
$form['actions']['delete']
Instead standard action use your own.
Firstly, do not allow users to delete nodes - by the proper
permissions settings.
Secondly add Publish/Unpublish button or just
show users Publish checkbox on edit form and instruct them how to
use it and how it works.
Maybe combination of modules can be helpful:
https://www.drupal.org/project/publishcontent
https://www.drupal.org/project/view_unpublished
https://www.drupal.org/project/override_node_options

Add custom control to DevExpress GridControl

I have a custom DateTimePicker control that prepared for Persian calendar. Is there any way to add it to the DevExpress GridControl column?
Please help me.
From: Creating a custom (RepositoryItem) ImageComboBox
If you wish to use your custom control in GridControl, it is necessary
to create an editor and its RepositoryItem descendants.
Please refer to the Custom Editors and How to register a custom
editor for use in the XtraGrid articles for complete information
on how to create custom controls. You can find some custom editor
descendants in our examples: editor descendants.
The RepositoryItem class contains editor settings and is used as
a template for cells in the grid. In the display mode, GridControl
only draws cells content via RepositoryItem's methods. In the edit
mode, GridControl creates a corresponding editor via the
RepositoryItem.CreateEditor method. Thus, if you wish to add items to
the editor used in the grid on its initialization, implement this at
the RepositoryItem level.
You can set an editor for the auto filter row if you handle GridView.CustomRowCellEdit event with following code
RepositoryItemDateEdit rd = new RepositoryItemDateEdit();
void gridView1_CustomRowCellEdit(object sender, DevExpress.XtraGrid.Views.Grid.CustomRowCellEditEventArgs e) {
GridView view = sender as GridView;
if(e.Column.FieldName == "DOB" && view.IsFilterRow(e.RowHandle)) {
e.RepositoryItem = rd;
}
}
Review the Assigning Editors to Columns and Card Fields help article to learn how to assign a specific editor to a particular GridView's column.
I hope you will find this information useful.

Add more details to Google Calendar event

Is it possible to add more details to a simple event in the google calendar. (extra information to the event)
For example, I would like to add an event with a checkbox for another user in the calendar. (The calendar is being used by 4 users and we like to be coordinated)
Thanks for the help.
You can use the Extended Properties
Adding and updating
Extended properties are set on the Events resource, and like other
fields can be set in insert, update, and patch requests. Using patch
requests is the preferred method, as it allows you to manipulate some
properties while leaving others untouched. Adding a new property with
the same key will overwrite any existing properties with the same key.
The following example shows setting a private property:
PATCH https://www.googleapis.com/calendar/v3/calendars/calendarId/events/eventId
{
"extendedProperties": {
"private": {
"petsAllowed": "yes"
}
}
}

How to create "Available field" properties in my own property?

I have created a class inherit from StateManagedCollection.
It has got a few class as Columns like GridView.
But I can not select which filed I want to select from.
It should look like the picture below in design.
But mine is the one below:
I have written the property as below:
[Description("A collection of ToolBarItem's ")]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
[Editor(typeof(System.ComponentModel.Design.CollectionEditor), typeof(System.Drawing.Design.UITypeEditor)), PersistenceMode(PersistenceMode.InnerProperty)]
public virtual Items Items
{
}
Can anyone help me out?
GridView columns collection uses a custom UI Type editor to show this interface. The in-built ASP.NET CollectionEditor will not show the required UI. Further in your case, CollectionEditor may not work if the collection's item type is a abstract class.
Solution is to build your own custom UI Type editor - basic steps are
Inherit from System.Drawing.Design.UITypeEditor.
Override GetEditStyle method to inform the property browser that you will launch modal form.
Override the EditValue method to launch your custom UI form.
Build the custom UI Form.
See a couple examples here (see sample for TagTypeEditor) and here.

Cannot access custom properties on nested user control

Ok, please understand the architecture here first.
OurMasterPage.aspx has user control Header.ascx
Header.ascx has a user control in it called LandingPageTopNav
LandingPageTopNav.ascx has a public property named "LandingPage" that is there to be able to set by the user using this control.
And I have a Third.aspx page in which I need to set the LandingPageTopNav property to a LandingPage object
The problem is that I can't get this to work in my ThirdPage.aspx.cs:
Master.LandingPageTopNav.LandingPage = this.landingPage;
Master.LandingPageTopNav.Visible = true;
And that is, I can't get the first line to work where I'm trying to reference the LandingPage property. The second line is fine. My Third.aspx definitely can reference my master page objects otherwise from code-behind.
I'd venture to guess that the LandingPageTopNav property of OurMasterPage doesn't return a value typed as LandingPageTopNav. It probably returns the correct control typed as something more generic (e.g. Control); which is why setting the Visible property works but not the LandingPage property.

Resources