Saturday, June 21, 2014

AX 2012 issue with menu item button not showing selected record in new form

I recently hit an issue where a lines record with a menu item button was not opening an associated form with the selected record. Normally, adding the menu item button to the form and tieing it to the data source would open the new form showing the record that I had selected on the previous grid.

The ultimate goal was to have a number of lines available in a details grid, select a record, and click a button which would open a new form and show an editable XML for data manipulation. A feature like this is absolutely imperative for interfaces. I've written similar functionality into existing interfaces but this one was tripping me up for some reason.

This is like AX Development 101 stuff. For some reason, there were things on this form preventing it from opening as it should. The normal methods were running short and I didn't want to resort to the menu item parameters via X++ yet. There had to be a way to do this some other way since it was not complex.

In  poking around a bit more, I set the 'CopyCallerQuery' property to 'Yes' instead of 'Auto' and the issue was resolved. See below for the menuItemButton having this property set to Yes.

I've never had to set this parameter before so I think the Auto was automatically triggering to 'Yes' but in this case, reverting to 'No'. Again, I've never encountered this before so I'm not sure why it would revert to 'No'. I did not investigate as to why this was happening, but did feel it important to post about. Hope it helps someone out. Even just one and this post is justified. #TigerBlood #Winning

UPDATE (3hrs after posting): Figured out the issue. Just tired so I didn't think of it at the time. I was calling a form which had that selected record from the caller form as the primary data source. There were no table relations as it was the same record. If the primary table on the second form is a different table with relations in place, the form would be fine without the parameter set below. 

1 comment:

  1. Thanks for the post! I had the same issue and your suggestion resolved it.