Acumatica - Copy Paste Function not working on Rich Text - acumatica

I added the copy-paste function to the tasks screen (CR306020) but somehow the detail section richtextbox of it wasn't being copied.
I tried to override the PXSelect view of it by removing the
[PXCopyPasteHiddenFields(typeof(CRActivity.body))]
and declared it as a public new PXSelect. but somehow it doesn't work.
any suggestion or ideas on how to make it work would be appreciated.

Related

Acumatica - Copy Paste functionality

On my screen, we have 3 level of master child relationship,
with the default Copy Paste functionality of Acumatica ,Parent and first child is copied but the second child Data is not getting copied.
Is there any place/function to debug the default copy paste functionality, or write our own custom paste function on top of what Acumatica is providing with same Paste button?
Edit for Brain Comments -
I have not added any attribute on the View.
First DAC of DATAview is perfectly OK with me, but it is not getting data for second view defined.
Data View -
As the Maint class is inheritade from PXRevisionableGraph -
Document (Default from Base graph)
public PXSelect<
Detail,
Where<Detail.CD, Equal<Current<Parent.CD>>,
And<Detail.revisionNo, Equal<Current<Parent.revisionNo>>>>,
OrderBy<
Asc<Detail.lineNbr>>>
details;
public PXSelect<
Detail2,
Where<Detail2.revisionNo, Equal<Current<Parent.revisionNo>>,
And<Detail2.formulaCD, Equal<Current<Parent.formulaCD>>>>,
OrderBy<
Asc<Detail2.lineNbr>>>
detail2;
Issue - details view is copied but details2 view is not getting copied
Finally I got to the root cause of the issue,
Copy paste works as expected for PXRevisionableGraph as it should, the issue was with the Attributes used with the DAC fields.
IN my case we have used PXFromula attribute that was used to calculate the SUM of the Child rows.
Once that is commented everything start working as expected.
we added the events for calculating the SUM instead of PXFormula now.

How do I add a Lead Source option

I'm trying to add options to the Source dropdown on the Leads screen. The field uses the CRMSourcesAttribute class to define the existing list. After simply creating a new attribute class to add my own items, I extend the CRLead.Source CacheAttached event to use my new attribute class instead. The result is that there is no change - the new dropdown items are not shown. After doing this, if I inspect the field and select the Drop Down Values button, I do actually see the new options in the Drop Down Values popup window. Any ideas on what could be preventing the new options from displaying in the dropdown itself?
Here's how I configure it in my LeadMaint graph extension:
[PXMergeAttributes(Method = MergeMethod.Append)]
[PXRemoveBaseAttribute(typeof(CRMSourcesAttribute))]
[CRMSourcesExt] // list with old + new options
protected virtual void _(Events.CacheAttached<CRLead.source> e) { }
(v20R2)
Another option is to use code and create a new attribute class with new options, then override the DAC field to use it instead. However, as far as I know, you still have to go through the steps of activating the new options in the workflow customizations UI for each of the fields you're overriding. But then you can refer to the new options in code without having to search the list's AllowedValues at runtime.
With help from a colleague, I was able to get it working, and “without code” through screen workflow customization. I removed my code, then customized it with a new custom Workflow copied from the default. Not sure yet of the ramifications of this, like if we can access the new options in other real code or not, but I see how to create these options now. It has to also be done for both Lead and Opportunity in this scenario. It’s a bit tedious and ethereal (good word) though. I can see this easily causing problems and unexpected results for us we’ll want to watch out for.
Update 5/28/21: I added the options in the Workflow customizations for the field, then copied the default workflow to a new workflow, activated it, and activated the new options for each state/transition. I don't like it, but Acumatica tells me "that's just the way it is now". Note: you'll want to do this for other places referencing CRMSourcesAttribute as well, such as Opportunity.

Xpages - Custom property using method binding option is not showing the content

I have a custom control with around 20 custom properties. However, some of these properties need to contain code logic. This is fine, as I create the property as Type: javax.faces.el.MethodBinding and Editor: Method Binding Editor which works fine.
However, once I close the editor, click somewhere else, then click back to the custom properties of my custom control, the code has disappeared. If I look at the source code however, the logic is visible. Its a little frustrating, as whenever I want to use the editor, I need to copy my code from the source and paste back into the editor (to help with formatting, showing errors as I type etc)
Has anyone else come across this and know how to fix it, or is this just another quirk of designer?
This image shows the empty property
This image shows the property has logic in the source code

Wrong View shown (Catel)

I'm trying to open a View with a ViewModel from my MainWindowViewModel.
It works, but all I get is a blank window. It binds the correct title but every other control is missing.
Did anyone have the same problem and found a solution?
You forgot the call to InitializeComponent in your code-behind. Just a tip: create a base class with the Catel behaviors, then use that as a base view. It will keep your actual window code-behind much cleaner.

Loading embedded resource .rtf file into richtextbox on load C#

Ok so I read about loading an embedded rtf into a rich text box and I am trying to do it when the form loads. The form is not the main form, it is a second form that loads when a control is clicked. This is what I have on the form when it loads:
private void Credits_Load(object sender, EventArgs e)
{
Assembly creditAssm = Assembly.GetExecutingAssembly();
using (Stream creditStream =
creditAssm.GetManifestResourceStream("YDisplayView.credits.rtf"))
{
creditsRichTextBox.LoadFile(creditStream, RichTextBoxStreamType.RichText);
}
}
In the solution explorer the rtf file shows as a resource and the build action is set to embedded resource.
when I click the button to load the form, it shows as expected, but nothing happens. The contents of the rtf doesn't seem to show :/
I can only assume I am doing it wrong :(
Any help for this newbie would be appreciated.
I figured it out:
creditAssm.GetManifestResourceStream("YDisplayView.credits.rtf"))
needed to be:
creditAssm.GetManifestResourceStream("YDisplayView.Resources.credits.rtf"))
Edit: For some reason this time around I can't get the above code to work but I found another one that did so hopefully either/or will be of some help to new coders out there :)
string rtf = yourAppName.Properties.Resources.yourEmbeddedRTFName;
yourRichTextBox.Rtf = rtf;
I wanted to create an rtf help file named Help.rtf and have it stored as a resource and so it could be loaded when a Help form was loaded without having a Help.rtf hanging around the application folders.
I found I needed to add the rtf file to the resources through the menu's Project-> 'Your name space' Properties... then navigate to Resources tab, then Add Item etc etc... before the intellisense would offer the rtf file in it's drop-down list when I typed 'My.Resource.' Now, the list of resources including the Help file I added shows up (without extension, which is normal).
In short, once this was done, then the following worked:
RichTextBox1.rtf = My.Resources.Help
Apparently it wasn't enough just to Drag&Drop, Copy or even add the file using the 'Solution Explorer'!
Spent 3 days on this problem so I hope someone finds it usefull.

Resources