GroupedAttachments Macro Property Group pluralized? - macros

I'm implementing grouped attachments as per https://docs.kentico.com/display/K8/Creating+grouped+document+attachments, and need to find out via a macro whether the group has attachments or not.
Only managed to realize that the name of the group "PortfolioGallery" is pluralized to "PortfolioGalleries" for some reason...
Is this because Gallery is some kind of reserved word in macro names, and gets pluralized always, or is this a 'feature' for the GroupedAttachments macro property? Or is it a bug?

Yes, it is a feature and it gets pluralized always.
Method ObjectRepository.GetNicePropertyName provides this functionality.

Related

How to access Method Names from source object in Rule Definition

In our implementation of the Rules Engine we have a test form similar to Rule Test Form on the online demo on "Business Rules Engine Demo". What we would like to do is conditionally show only the Test Fields for the items in use in the rule. We are doing this by grabbing the rule.definition JSON from the ruleeditor then look for the items which we can conditionally create using AngularJS's ng-if directive. This works great with Fields. If the user selects a method, our method of parsing the string is failing. What it appears is the Field Names are stored in the JSON as plain text however the Method Names are not. Is there a way we can configure the control to either A not encrypt the method names or is there a way that we can tap into the encryption to identify if a method is in use in our rule? Thanks in advance.
Methods and actions can have overloads which the Code Effects rule editor supports. Therefore, we can't have multiple menu entries with the same name. Instead, we use a signature hash on all in-rule methods and rule actions regardless of whether it has an overload or not to make them unique on the client.
You need to have either the Full Source or the Editor Source license in order to change the code to either stop that hashing, or tap into the process, or implement it your own way. You don't have that option with any other Code Effects perpetual license.

Can I use immutable identifiers in office.js.api?

Can I use immutable identifiers link from GRAPH API in office.js.api?
Somehow setting needed header to make identificatory not changeable if email is switched from Draft to Sent folder for example?
No. Immutable IDs do not work with any office.js apis. The only itemID available is the EWSId via Office.context.mailbox.item.itemId. However, as you noted the EWSId will change if the item switches folders.
You may be able to use Graph/REST to translate the EWSId into immutable: https://learn.microsoft.com/en-us/graph/api/user-translateexchangeids?view=graph-rest-1.0&tabs=http
But Office.js inputs/outputs are always EWSId's in the function.

TYPO3 tx_news use same database field for custom extension

I'm building a proper extension for the management of real estate, I would like to use the added "Image Metadata" field "Show in list view" as the extension tx_news does.
I can build this option in exactly as tx_news does but in case the site instalation uses both extensions, does this cause a conflict ? ( I'd use the same field name showinpreview )
Should I use a different field name to avoid trouble?
( I plan to use this feature in the exact same fashion, so I can easily share the use of the field in the "sys_file_reference" table ... if there was no other conflict there could be the case that an image was used in both extensions and the selection would be determined by one of the two extensions for both or do I misunderstand something here... )
anybody did experiments with this and can avoid me the trouble ?
I never had this use case but both ways are possible.
- use the same field: less code needed but your extension depends on news
- new field: also fine
You can use the same field as there also is a field which identifies the table the record belongs to.
Be sure to stay in sync with tx_news. either by a dependency, which might be a great overhead if you don't use tx_news otherwise, or with the same declaration as in tx_news, this can conflict if tx_news changes declaration unnoticed.
You have to declare your own access which will be independent as you use other namespace and context.

API.AI Intent won't save when adding Required Action

I'm trying to create a chat bot that will help users search up motorcycles.
I'm new to API.AI and have set up my entities and their synonyms, my intent and user expressions, as well as references to the entities (#engineSize, #make, #bikeType).
My problem is when I try to add a required action and prompt, and then try to save the intent, I get the following message:
"The following entities reference each other and form an infinite loop: [engineSize]."
Initially I thought I was using the references wrong in the user expressions. I deleted every reference except for one expression which uses all three entities.
I can't figure out what I'm doing wrong. Any help would be greatly appreciated, thanks! Pix below for further details.
EDIT: I fixed one of the issues of trying to pass a template expression as an example. However, I still get the same error message. I will replace and update my image links to include the edits.
Annotated User expressions
Required Actions
Interestingly enough, the answer to this post would have been difficult to find because the problem was in defining my entities.
In the entity definitions, I included an #ref to the entity itself. ie the bikeType entity contained #bikeType as one of its definitions.
This is not to be mistaken with the User Expressions. As long as the user expression is marked as a Template (the entire line is denoted with an '#' on the far left, as opposed to a large " ), there should be no issues.
Edited for clarity to get at root problem
In the provided user input examples you give the intent, you are supposed to provide general examples and then highlight any text belonging to an entity to map where entities appear in user's inquiries.
In your case, you have input the actual entity reference '#engineSize' as an example belonging to the engineSize entity, creating a self reference.
A proper provided user example would look like:
Also note though that if you are just using entities to store generic information like numbers, addresses, times, etc. it generally makes far more sense to use prebuilt system entities for those categories than create a custom entity, for example #sys.number-integer might be exactly what you need
It looks like you need to get a firmer understanding of entities, for which I would recommend the documentation:
https://docs.api.ai/docs/concept-entities

MEF: Importing on Fields

Is it recommended that we place an Import on a property instead of a field? I tried it on a field and it is working but Resharper is telling me a warning that the field was never initialized.
ReSharper doesn't recognize that MEF will be setting the variable and since there is no guarntee that MEF will be setting the variable (example if it isn't put into a container for example), so it is reasonable for ReSharper to warn about this. You can either ignore it or simply initialize the field to null (or default(T)).
As for whether or not you should use a property or field I think using a field is fine (assuming it is not public). I generally reserve properties for things I want to expose publicly. One special case to consider here is that there are some issues having Imports on private members in low trust scenarios like SL or paritial trust because MEF uses reflection and you cannot use private reflection in some of those scenarios.