0

Can I retrieve an Entity annotations using JavaScript in CRM 2011? Or it's doable only using server side code?

2 Answers 2

1

You can retrieve annotations querying AnnotationSet via OData.

All entities where notes are active should also have a relationship called [name of entity]_annotations that you can $expand

Sign up to request clarification or add additional context in comments.

Comments

1

That's possible using OData and JavaScript. Other thing is why do you need it?

UPD. You can use following code as a basic for your functionality:

            var isAttached = false;

            XrmSvcToolkit.retrieveMultiple({
                entityName: "Annotation",
                odataQuery: "$select=AnnotationId&$filter=ObjectId/Id eq guid'" + Xrm.Page.data.entity.getId() + "' and IsDocument eq true",
                async: false,
                successCallback: function (results) {
                    isAttached = results.length > 0;
                },
                errorCallback: function (error) {
                    alert(error.message);
                }
            });

            if (!isAttached) {
                Xrm.Utility.alertDialog("Attach document first!");
                return;
            }

1 Comment

Because in my case attaching documents is mandatory, so i need to check from client side if the user has attached mandatory files or not before saving the entity record

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.