How to Insert image / documents from ASP.NET to Dynamics AX using Business Connector ?

I tried by creating a method in AX Table and called that method using Business Connector in .Net but i am unable to pass parameters to it.

This would be better placed in the developers group. I’ll move it.

Tanq Jake Roder

Could you elaborate what you mean by “unable to pass parameters”?

Also, you’ve tagged this question with both AX 2009 and AX 2012. Which one is correct? Or does it mean that you’re looking for a single solution that can be used with both?

Tanq Martin for your response,
Yes I m looking for a single solution to work with both AX 2009 and AX 2012.

Below is the method created by me to attach documents in my Ax table.

Public void portalDocuAttach(str _path ,EmplId _emplID ,str _typeID)
DocuRef docuRef;
DocuActionArchive archive;
PREmplIncomeTaxPortal taxPortal;
str name;
name = _path;

select RecId from taxPortal where taxPortal.EmplId == _emplID;

if (taxPortal!=null)
docuRef.RefRecId = taxPortal.RecId;
docuRef.RefTableId = tableNum(“EMPLINCOMETAX”);
docuRef.RefCompanyId = “dbsp”;
docuRef.Name = name;
docuRef.TypeId = _typeID;
archive = new DocuActionArchive();
archive.add(docuRef, name);

and i am calling this method in C#.NET as below

object[] myObjArray = { “C:\Users\Card.jpg”, “0007”,“image” };
ax.CallStaticRecordMethod(“PREMPLINCOMETAXPORTAL”, “portalDocuAttach”, myObjArray);

**it is throwing error as invalid parameters…

First of all, you use CallStaticRecordMethod() but your method isn’t static. You have to make it static first.

Tanq so much martin . that’s the mistake i have done and can u plz explain me how to retrieve image from HCM PERSON IMAGE table and display in ASP.NET webpage using .Net Business Connector.

What exactly is your problem? I can’t analyze, design and develop the whole thing for you, therefore you’ll have to identify what you can do by yourself and explain where you need our help.

Hello Martin,
I want to display the Employee Details from HcmWorker Table and Image from HCM PERSON IMAGE TABLE to my webpage using business connector .I am unable to convert the image from varbinary(max) to image in my ASP.NET .

When I’m trying to display image in my webpage it is displaying empty image against employees.

Thanks in advance.

So which of those two ways have you used?

I tried both ways but no use. So please help me dat how to retrieve image from AX Table and display in Asp.Net webpage using business connector.

I’m sorry, but I can’t help you if you don’t tell me what exactly is the problem. “To retrieve image from AX Table and display in Asp.Net webpage using business connector” consists of many different things and trying to deal with all possible ways and possible problems would be an infinite task.
If you want somebody to design and develop the whole thing for you, you’ll have to hire her or him.
Otherwise I (again) suggest you think of your requirements, choose of one of those two ways I suggested, try to implement it and ask here if you run into a specific problem.

It’s possible that you don’t know how to decompose the problem to smaller pieces. For example, try to show a static image in your ASP.NET application. If you can do it, then you can remove this problem from the question. Similarly, try to save the image from AX to disk or return it by your service (depending on which solution you choose), without considering ASP.NET at all.

If you try to do everything at once, you’ll achieve nothing.