Specified cast is not valid
Unable to cast object
I'm trying to override the "NoteID", base screen Header table field(Location<==Table). After override the NoteID field I got the above two error's.
(Newly I added the activities tab in "Customer Location" screen. Initially it was like this when I click on the add task button):
"Related Entity" field is in blank (It should come after we click on the "Add task" button
Like this screen "Related Entity" should come with fill after we click on the "Add task" button
I tried two ways to override the NoteID field (This is the first one):
[PXNonInstantiatedExtension]
public class CR_Location_ExistingColumn : PXCacheExtension<PX.Objects.CR.Location>
{
#region NoteID
//public abstract class noteID : PX.Data.BQL.BqlGuid.Field<noteID>
//{ }
[PXMergeAttributes(Method = MergeMethod.Append)]
[PXSearchable(
PX.Objects.SM.SearchCategory.All,
"{0}: {1} -{2}",
new Type[]
{
typeof(Location.locationID),
typeof(Location.locationCD),
typeof(Location.descr)
},
new Type[]
{
typeof(Location.isActive),
typeof(Location.locationCD),
typeof(Location.descr),
},
NumberFields = new Type[] { typeof(Location.locationCD) },
Line1Format = "{0}{1}{2:d}",
Line1Fields = new Type[]{typeof(Location.locationCD),
typeof(Location.descr),
typeof(Location.isActive) },
Line2Format = "{0}",
Line2Fields = new Type[]{typeof(Location.locationCD)
})]
[PXNote(DescriptionField = typeof(Location.locationCD),
Selector = typeof(Location.locationCD),
ShowInReferenceSelector = true, BqlField = typeof(Location.noteID))]
public Guid? NoteID { get; set; }
#endregion
}
And this is the 2nd try:
#region Location_NoteID
public abstract class noteID : PX.Data.BQL.BqlGuid.Field<noteID> { }
[PXSearchable(
PX.Objects.SM.SearchCategory.All,
"{0}: {1} -{2}",
new Type[]
{
typeof(Location.locationID),
typeof(Location.locationCD),
typeof(Location.descr)
},
new Type[]
{
typeof(Location.isActive),
typeof(Location.locationCD),
typeof(Location.descr),
},
NumberFields = new Type[] { typeof(Location.locationCD) },
Line1Format = "{0}{1}{2:d}",
Line1Fields = new Type[]{typeof(Location.locationCD),
typeof(Location.descr),
typeof(Location.isActive) },
Line2Format = "{0}",
Line2Fields = new Type[]{typeof(Location.locationCD)
})]
[PXNote(DescriptionField = typeof(Location.locationCD),
Selector = typeof(Location.locationCD),
ShowInReferenceSelector = true, BqlField = typeof(Location.noteID))]
[PXFormula(typeof(Default<Location.noteID>))]
[PXMergeAttributes(Method = MergeMethod.Merge)]
public virtual void Location_NoteID_CacheAttached(PXCache sender)
{
}
#endregion
I'm new to the Acumatica coding environment. Where is the mistake and how to overcome this issue?