Error on Displaying attribute - acumatica

I was trying to display one of the 'Estimated Hours Remaining' attribute of 'Project' in a new page called 'Appointments'.
So, I created an unbound field name 'ProjectEstimatedRemainingHours'. Then customized attribute of the field like this:
using PX.Objects.IN;
using PX.Objects.PM;
[PXString(40)]
[PXUIField(DisplayName="Project Estimated Remaining Hours")]
[PXDBScalar(
typeof(Search<PMProject.productCD,
Where<PMProject.productID, Equal<FSServiceOrder.productID>>>))]
I was trying to see if I can get any property of 'Project' first.
But then, I encountered the following error:
The weird part is even if I unpublish or even remove the customize project on which I was making this change, this error persists.
I need help to get the 'Estimated Remaining Hours' attribute of 'Project' without getting error.

Related

Kentico 9: Auto Add Binding in Custom Module

I have created a custom module (actually I have created a handful in recent years, and this same obstacle frustrates me every time) following the Kentico documentation:
https://docs.kentico.com/display/K9/Creating+custom+modules
The problem I end up with every time, is in developing the User Interface for Parent/Child classes. I create a Vertical Tab node, and beneath it I add an edit tab and a Binding tab for the child class. This all works, and I can add and remove bindings at will, but what I can't do is ADD a new child class and bind it.
Using the Standard Edit Binding template, I am able to bind EXISTING Job Titles to the selected Category, but I cannot CREATE a new one from that page:
To solve this, I created a custom Edit Binding template, and added a New Child Class Header Action that points to a New / Edit Object child:
Which gives me a button that I can use to add a new child class (Job Title):
This approach works per se, in that I can click the New Job Title button and create a new item on the subsequent page:
But no binding is created to link the child object (Job Title) to the selected parent object (Category), An even bigger problem is that once I click Save, I am presented with the following:
The new object DOES SAVE, but the post-save navigation is somehow failing. The event log offers little in the way of diagnostics:
So I thought to create a completely custom interface to accomplish my needs here, according to the Kentico documentation:
https://docs.kentico.com/display/K9/Manually+creating+the+interface+for+custom+modules
So I change the Element Content of the New Job Title page to a custom page that I created to post a DataForm for the new object:
Taking care to assign the proper Object Types on the Properties Tab:
The intent was to programmatically create the binding upon save and also handle the correct navigation to avoid the ambiguous parameter error above, but when this page loads, the UIContext.ObjectID and UIContext.ParentObjectID are both 0:
So I cannot create the binding programmatically. I was able however to solve the error that I received by manually assigning the redirect. The experience is still lacking even with this hack, since it returns to the listing page, but the user still has to click "Add Items" to assign the binding after successfully creating it with the custom page I built.
This cannot be the proper way to do this, so any help with getting me on the right track would be greatly appreciated.
In order for the EditedObject to have a value you have to either decorate the page with the EditedObjectAtribute e.g. like this:
[EditedObject("<custom.objecttype>", "<objectid>", ...)]
or set the object yourself:
int objectId = QueryHelper.GetInteger("objectid", 0);
EditedObject = SomeInfoProvider.GetSomeInfo(objectId);
In your case, I'd recommend exploring what query parameters are available on the page and using them to fetch appropriate object(s). Also, make sure "JobCategoryId" is passed to the "New Job Title" dialog so that you can create the binding.
Btw - kudos for well asked question!

Setting field read-only depending on errors

I have few components- combo boxes, edit boxes and error messages.
What I'm trying to do is to make combo box read only if the error message (that is attached to the edit box) contains something.
I'm trying to use this in the "read-only" computed field:
getComponent("message3").value == ""
Apparently i'm doing something wrong and it throws error when I load the xpage. Any advice how to achieve the functionality I need?
You can use the following to check for error messages:
facesContext.getMessages().hasNext()

How to extend ShapeMenuItem with URL field

I'd like to use this existing MenuItem to use shapes for certain menu items. However I'd like a field to input URL like Custom Link has. So I've added new Input field to ShapeMenuItem ... But so far I'm unable to access it's value in shapes themselves
I've tried
<a class="highlight" href="#Model.Content.ContentItem.ShapeMenuItem.Url.Value">#Model.MenuItem.Text</a>
But that gives me server error Cannot perform runtime binding on a null reference
Any ideas?
Ok it was just stupid me again in late hours, it's supposed to be
#Model.MenuItem.Content.ContentItem.ShapeMenuItem.Url.Value

Watir can´t access zk element with z-index>0

I´m testing a zk application. I´m trying to click an option on combobox by its text.
So I'm not get that bacause thah option is inside a div with z-index=88000.
when I check visibility from that div, returns false.
I tried to change z-index via javascript code for 0.
I used the following code:
browser.execute_script("document.getElementByClass('z-combobox-pp')[5].style.zIndex='0';")
but I didn't get it. I got that error:
document.getElementByClassName is not a function (Selenium::WebDriver::Error::JavascriptError)
I cannot explain the z-index issue.
However, the javascript error is occurring because the getElementByClass method does not exist. It should be getElementsByClass (notice the 's' in 'Elements').
Try changing the z-index with:
browser.execute_script("document.getElementsByClass('z-combobox-pp')[5].style.zIndex='0';")

Orchard error with rendering widget

I'm getting this error:
'Orchard.ContentManagement.ContentItem' does not contain a definition for 'LatestProductPublicationPreview'
I have created the Content Type with the same name, and set it to "Widget".
This is the line failing in the view:
var contentType = Model.ContentItem.LatestProductPublicationPreview;
Any ideas?
That's because there is no LatestProductPublicationPreview property on ContentItem. It's hard to tell what you're trying to do from what little information there is in the question, or what you expect but I'll try. Are you saying that you have a content type named LatestProductPublicationPreview? If so, you don't have to specify that, in general. If you want to get to the title part of that content item, you'd do Model.ContentItem.TitlePart. Now if you want to access the Value property of field Foo, you'd do Model.ContentItem.LatestProductPublicationPreview.Foo.Value. etc.

Resources