A search provider using Azure Search is in a separate project from core & web v8.18 and in the same solution.
Content is available through strongly typed models, however I am finding when I access the form picker I only have the GUID available and not the properties of the picked form.
Can I pass the GUID to and get the basic form details? I need just the name of the form that is picked.
There is no reference to the Umbraco.Forms namespace from my project if I try to add a using. Can this reference be added?
The content to be indexed is received via a publishing event.
All thoughts greatly valued. Thank you in advance :)
I got some of the way there to an answer
It made sense to me to extend the model so that the form name property is in the model. I found my way blindly to this and it still doesn't quite work right.
public partial class FormBlock
{
public string FormName
{
get
{
if (this.Form != null)
{
var fs = Umbraco.Web.Composing.Current.Factory.GetInstance<Umbraco.Forms.Core.Services.IFormService>();
var form = fs.Get(this.Form);
return form.Name;
}
else
return string.Empty;
}
}
}
it throws a SQL error and my guess is that what I am doing here is fundamentally wrong, not really sure if this is how I should create an instance of the service.
Getting Form name by GUID from separate project
A search provider using Azure Search is in a separate project from core & web v8.18 and in the same solution.
Content is available through strongly typed models, however I am finding when I access the form picker I only have the GUID available and not the properties of the picked form.
Can I pass the GUID to and get the basic form details? I need just the name of the form that is picked.
There is no reference to the Umbraco.Forms namespace from my project if I try to add a using. Can this reference be added?
The content to be indexed is received via a publishing event.
All thoughts greatly valued. Thank you in advance :)
I got some of the way there to an answer It made sense to me to extend the model so that the form name property is in the model. I found my way blindly to this and it still doesn't quite work right.
it throws a SQL error and my guess is that what I am doing here is fundamentally wrong, not really sure if this is how I should create an instance of the service.
I read this should be an injected dependency and not created like a v7 service. Does that mean it can't really be created as a part of the model?
Yes - this was a truly terrible idea.
is working on a reply...