Skip to main content
Solved

Configuration Entry - Adding Configurable Image


CDerstine25
Freshman II

I am trying to modify the Configuration Entry Screen (AM306000) to add an image selector. 

This is what I’m trying to do, but even though I was able to add the ‘FILES’ menu to the toolbar, clicking on it produces an error, as though it can’t figure out how to add files to this screen, most likely because this screen is not a main screen and is called from several places. The image control itself I was able to create, but the browse/upload buttons do absolutely nothing, like it is read only.

 

Is it possible to do what I’m trying to achieve or am I going to drive myself mad figuring this out?

 

I also saw this feature suggestion from 4 years ago that matches what I’m trying to do for the most part 

https://community.acumatica.com/ideas/product-configurator-images-1521

 

Best answer by CDerstine25

@Chris Hackett I got a reply from Acumatica support last week, the only thing that seemed different from their solution and mine was putting that class into a PXFilter object. I don’t know if this will make a difference inside the configurator or not, because they did not code it inside the configurator, just on its own page. 

 

I haven’t had the chance to test this yet as I was pulled to another project. Today hopefully I can find time.
 

  public class ImageUploadTest : PXGraph<ImageUploadTest>
  {

    public PXSave<MasterTable> Save;
    public PXCancel<MasterTable> Cancel;


    public PXFilter<MasterTable> MasterView;
    public PXFilter<DetailsTable> DetailsView;

    [Serializable]
    public class MasterTable : IBqlTable
    {
     #region UsrImageUrl

        /// <summary>

        /// The URL of the image associated with the item.

        /// </summary>

        [PXDBString(255)]

        [PXUIField(DisplayName = "Image")]

        public String UsrImageUrl { get; set; }

        public abstract class usrImageUrl : BqlString.Field<usrImageUrl> { }

        #endregion



        #region NoteID

        /// <summary>

        /// The NoteID of this record.

        /// </summary>

        [PXNote]

        public Guid? UsrNoteID { get; set; }

        /// <inheritdoc cref="UsrNoteID" />

        public abstract class usrNoteID : PX.Data.BQL.BqlGuid.Field<usrNoteID> { }

        #endregion

    }

    [Serializable]
    public class DetailsTable : IBqlTable
    {

    }


  }

 

View original
Did this topic help you find an answer to your question?

7 replies

Forum|alt.badge.img+4

I’m not personally familiar with this specific screen, but I have added the image uploader control to my own screens so hopefully can provide some insight.  You mention it is used on multiple screens.  If this is compiled into multiple screens from a common include file, make sure each graph has the data member/view you will use and that the DAC of that view contains a Note ID field marked with [PXNote].

If the prerequisites are met, it should be easy to add the control.  Since it’s on the screenshot, I have to assume you are missing one of the prerequisites.

First, the DAC to which the files will be attached must have a NoteID field marked with [PXNote].  Simply adding the file indicator along won’t work if you don’t have the NoteID field that stores the guid linking the attachments to the record.  If adding to a standard DAC, you should name the field something like UsrZZNoteID of type Guid?.  Next, on the DAC that contains the noteID that links to the images, add the following field.  (This code sample is pulled from a custom screen with a custom DAC, so be sure to apply the standard field name prefix if adding to a standard DAC, i.e. UsrZZImageUrl where ZZ is your 2 character prefix.)

#region ImageUrl
[PXDBString(255)]
[PXUIField(DisplayName = Messages.FldImageURL)]
public virtual String ImageUrl { get; set; }
public abstract class imageUrl : PX.Data.BQL.BqlString.Field<imageUrl> { }
#endregion

Next, we add the control, which appears to be on the screen, so you probably did this ok.  Be sure to check the field tied to it though to make sure it exists.  Note DataField=”ImageUrl” which you would change to the name of your field.

<px:PXImageUploader DataMember="CurrentItem" Height="320px" Width="430px" ID="imgUploader" runat="server" DataField="ImageUrl" AllowUpload="true" ShowComment="true" ></px:PXImageUploader>

Finally, make sure the control is bound to a view that is refreshing properly.  In my case, this is DataMember="CurrentItem".

In summary, you need:

  • Guid? field decorated with [PXNote] on the DAC that will have file attachments
  • A field to hold the default image to display in the control (commonly ImageUrl)
  • Data view defined in the graph for accessing the ImageUrl field which will store the selected image information.   If this is part of the primary DAC, you should have an alternate copy of the view, i.e. CurrentItem, like in the Stock Items screen and linked back to the Current {whatever your DAC’s key fields are}.
  • PXImageUploader control to show the pictures that are attached to the record.

For another example of this control for reference, it appears on the Attributes tab of the Stock Items screen.


CDerstine25
Freshman II
  • Author
  • Freshman II
  • 8 replies
  • November 8, 2023

Hi @Brian Stevens . Thanks for that. I already had the Image Url declared. I added the Note ID as you suggested and that DID fix the object reference not set to an instance of an object for the ‘Files’ button, and added a ‘Notes’ button unintentionally. My DAC now looks like this:

#region UsrImageUrl
/// <summary>
/// The URL of the image associated with the item.
/// </summary>
[PXDBString(255)]
[PXUIField(DisplayName = "Image")]
public String UsrImageUrl { get; set; }
public abstract class usrImageUrl : BqlString.Field<usrImageUrl> { }
#endregion

#region NoteID
/// <summary>
/// The NoteID of this record.
/// </summary>
[PXNote]
public Guid? UsrNoteID { get; set; }
/// <inheritdoc cref="UsrNoteID" />
public abstract class usrNoteID : PX.Data.BQL.BqlGuid.Field<usrNoteID> { }
#endregion

Problem is, the image uploader still doesn’t work. Clicking the Browse and Upload buttons does nothing.

<px:PXImageUploader Height="320px" Width="430px" ID="imgUploader" runat="server" DataField="UsrImageUrl" AllowUpload="true" AllowNoImage="true" ShowComment="true" DataMember="CurrentResults"
></px:PXImageUploader>

 


CDerstine25
Freshman II
  • Author
  • Freshman II
  • 8 replies
  • November 8, 2023

Hi again. 

I realize uploading an image to the files does populate the image in the image selector. I would like the brows and upload buttons working though.


Forum|alt.badge.img+4
CDerstine25 wrote:

Hi again. 

I realize uploading an image to the files does populate the image in the image selector. I would like the brows and upload buttons working though.

You can drag an image on the control for it to upload, but I haven’t worked with the browse and upload portion.  I only use the control to show attached images.


CDerstine25
Freshman II
  • Author
  • Freshman II
  • 8 replies
  • November 13, 2023

Sorry for late reply, last week got busy. 

The control only allows ONE picture to be uploaded. If you upload a second, the first one only shows, and unlike the stock item screen where it has a left and right button to cycle through pictures, my control currently does not, so you can’t change the photo even if you uploaded multiple, and that is a key component of what I need to do. I need them to upload multiple images to the configuration and then add the images to each type of configuration as picked from the treeview on the left.


Chris Hackett
Community Manager
Forum|alt.badge.img
  • Acumatica Community Manager
  • 2547 replies
  • December 14, 2023

Hi @CDerstine25 were you able to find a solution? Thank you!


CDerstine25
Freshman II
  • Author
  • Freshman II
  • 8 replies
  • Answer
  • December 15, 2023

@Chris Hackett I got a reply from Acumatica support last week, the only thing that seemed different from their solution and mine was putting that class into a PXFilter object. I don’t know if this will make a difference inside the configurator or not, because they did not code it inside the configurator, just on its own page. 

 

I haven’t had the chance to test this yet as I was pulled to another project. Today hopefully I can find time.
 

  public class ImageUploadTest : PXGraph<ImageUploadTest>
  {

    public PXSave<MasterTable> Save;
    public PXCancel<MasterTable> Cancel;


    public PXFilter<MasterTable> MasterView;
    public PXFilter<DetailsTable> DetailsView;

    [Serializable]
    public class MasterTable : IBqlTable
    {
     #region UsrImageUrl

        /// <summary>

        /// The URL of the image associated with the item.

        /// </summary>

        [PXDBString(255)]

        [PXUIField(DisplayName = "Image")]

        public String UsrImageUrl { get; set; }

        public abstract class usrImageUrl : BqlString.Field<usrImageUrl> { }

        #endregion



        #region NoteID

        /// <summary>

        /// The NoteID of this record.

        /// </summary>

        [PXNote]

        public Guid? UsrNoteID { get; set; }

        /// <inheritdoc cref="UsrNoteID" />

        public abstract class usrNoteID : PX.Data.BQL.BqlGuid.Field<usrNoteID> { }

        #endregion

    }

    [Serializable]
    public class DetailsTable : IBqlTable
    {

    }


  }

 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings